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()); }
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()); }