Home > OS >  Let io_context about Linux CPP programming using boost timer. Run behind the problem of parallel exe
Let io_context about Linux CPP programming using boost timer. Run behind the problem of parallel exe

Time:09-17

Your bosses, my questions like this:

Have A class for A, hope when performing its Start function to register A timer, regularly check the class member variables, this class might be instantiated multiple instances of the use of the code is:
 
The timer=boost: : an asio: : deadline_timer (io_timer, boost: : posix_time: : seconds (60));
The timer. Async_wait (boost: : bind (& amp; Server: : timer_tick, this));

Boost: : thread thread_timer (boost: : bind (& amp; Boost: : an asio: : io_service: : run, & amp; Io_timer));
//thread_timer. The join ();
//io_timer. The run ();
//timer Settings complete


& Server: : timer_tick as the callback function, A class member function

Io_timer. The run (); Execution will lead to subsequent code cannot execute, could you tell me how to do the timer and other code executed in parallel?
  • Related