예제 #1
0
void Semaphore_Mutex_Actions::release_action(const char*) {
  if (Force_Direct_Squeak_Interpreter_Access)
    return;
  
  OS_Mutex_Interface* mutex = get_mutex();
  if (tracking)  mutex->set_holder(-1);
  OS_Interface::abort_if_error("Semaphore_Mutex", mutex->unlock());
}
예제 #2
0
void Scheduler_Mutex_Actions::acquire_action(const char* why) {
  OS_Mutex_Interface* mutex = get_mutex();

  // spin and receive to avoid deadlock; other core may be trying to send US something
  Timeout_Timer tt("scheduler mutex", 60, mutex->get_holder()); tt.start();
  while (0 != mutex->try_lock()) {
    Timeout_Timer::check_all();
    mutex->dec_and_check_recursion_depth();
    Message_Statics::process_any_incoming_messages(false); // could check to ensure no_message
    mutex->check_and_inc_recursion_depth();
  }
  if (tracking) mutex->set_holder(Logical_Core::my_rank());
}
예제 #3
0
void Semaphore_Mutex_Actions::acquire_action(const char*) {
  if (Force_Direct_Squeak_Interpreter_Access)
    return;
  
  // xxxxxx This code could/should be better factored across the various mutexes. -- dmu 4/09

  // spin and receive to avoid deadlock; other core may be trying to send US something

  OS_Mutex_Interface* mutex = get_mutex();

  assert_always(!mutex->is_held()); // deadlock check
  Timeout_Timer tt("semaphore mutex", check_assertions ? 300 : 60, mutex->get_holder()); tt.start();
  while (!mutex->try_lock()) {
    Timeout_Timer::check_all();
    mutex->dec_and_check_recursion_depth();
    Message_Statics::process_any_incoming_messages(false); // could check to ensure no_message
    mutex->check_and_inc_recursion_depth();
  }
  if (tracking) mutex->set_holder(Logical_Core::my_rank());

}
예제 #4
0
void Scheduler_Mutex_Actions::release_action(const char*) {
  OS_Mutex_Interface* mutex = get_mutex();
  if (tracking)  mutex->set_holder(-1);
  OS_Interface::abort_if_error("Scheduler_Mutex", mutex->unlock());
}