コード例 #1
0
  void FinalizerHandler::perform(STATE) {
    GCTokenImpl gct;
    utilities::thread::Thread::set_os_name("rbx.finalizer");

    state->vm()->thread->hard_unlock(state, gct);

    while(!exit_) {
      if(!process_list_) first_process_item();

      if(!process_list_) {
        utilities::thread::Mutex::LockGuard lg(worker_lock_);

        if(finishing_) supervisor_signal();

        // exit_ might have been set in the mean while after
        // we grabbed the worker_lock
        if(!exit_) {
          GCIndependent indy(state);
          worker_wait();
        }

        continue;
      }

      finalize(state);
      next_process_item();
    }
  }
コード例 #2
0
ファイル: finalize.cpp プロジェクト: Energy0124/rubinius
 void FinalizerHandler::start_collection(STATE) {
   if(process_item_kind_ == eRelease) {
     while(process_list_) {
       finalize(state);
       next_process_item();
     }
   }
 }
コード例 #3
0
ファイル: finalize.cpp プロジェクト: Energy0124/rubinius
  void FinalizerHandler::perform(STATE) {
    GCTokenImpl gct;
    const char* thread_name = "rbx.finalizer";
    self_->set_name(thread_name);

    RUBINIUS_THREAD_START(thread_name, state->vm()->thread_id(), 1);

    state->vm()->thread->hard_unlock(state, gct, 0);

    while(!exit_) {
      state->vm()->set_call_frame(0);

      if(!process_list_) first_process_item();

      if(!process_list_) {
        {
          utilities::thread::Mutex::LockGuard lg(worker_lock_);

          if(finishing_) supervisor_signal();

          // exit_ might have been set in the mean while after
          // we grabbed the worker_lock
          if(exit_) break;
          state->gc_independent(gct, 0);
          paused_ = true;
          pause_cond_.signal();
          worker_wait();
          if(exit_) break;
        }
        state->gc_dependent();
        {
          utilities::thread::Mutex::LockGuard lg(worker_lock_);
          paused_ = false;
          if(exit_) break;
        }

        continue;
      }

      finalize(state);
      next_process_item();
    }
    RUBINIUS_THREAD_STOP(thread_name, state->vm()->thread_id(), 1);
  }