예제 #1
0
    void unpark() {
      utilities::thread::Mutex::LockGuard lg(mutex_);
      if(!sleeping_) return;

      wake_ = true;
      cond_.signal();
    }
예제 #2
0
파일: state.cpp 프로젝트: dziulius/rubinius
    void unpause() {
      utilities::thread::Mutex::LockGuard guard(mutex_);

      // idle, just waiting for more work, ok, thats fine.
      if(state != cPaused) return;

      pause_ = false;

      condition_.signal();
    }
예제 #3
0
파일: state.cpp 프로젝트: dziulius/rubinius
    void stop() {
      {
        utilities::thread::Mutex::LockGuard guard(mutex_);
        if(state == cStopped) return;

        stop_ = true;

        if(state == cIdle) {
          condition_.signal();
        } else if(state == cPaused) {
          // TODO refactor common from unpause
          pause_ = false;
          condition_.signal();
        }
      }

      join();

      {
        utilities::thread::Mutex::LockGuard guard(mutex_);
        state = cStopped;
      }
    }
예제 #4
0
파일: state.cpp 프로젝트: dziulius/rubinius
 void add(BackgroundCompileRequest* req) {
   utilities::thread::Mutex::LockGuard guard(mutex_);
   pending_requests_.push_back(req);
   condition_.signal();
 }