Beispiel #1
0
 WorldState()
   : pending_threads_(0)
   , should_stop_(0)
   , time_waiting_(0)
 {
   mutex_.init();
   waiting_to_run_.init();
 }
Beispiel #2
0
 WorldState(bool* check_global_interrupts)
   : pending_threads_(0)
   , should_stop_(0)
   , check_global_interrupts_(check_global_interrupts)
   , time_waiting_(0)
 {
   mutex_.init();
   waiting_to_run_.init();
 }
Beispiel #3
0
 /**
  * Called after a fork(), when we know we're alone again, to get
  * everything back in the proper order.
  */
 void reinit() {
   // When we're reinitting the world state, we're stopped
   // so we have to initialize pending_threads_ to 0 and
   // should_stop to 1 so we start off in the proper state
   // and can continue after a fork.
   pending_threads_ = 0;
   should_stop_ = 1;
   mutex_.init();
   waiting_to_run_.init();
 }
Beispiel #4
0
    void restart() {
      mutex_.init();
      condition_.init();
      pause_condition_.init();

      state = cUnknown;
      stop_ = false;
      pause_ = false;
      paused_ = false;

      run();
    }
 void unlock() {
   stop_ = false;
   wait_condition_.broadcast();
   lock_.unlock();
 }