mirror of
https://github.com/open-simh/simh.git
synced 2026-01-25 11:55:43 +00:00
TIMER: Changed sim_idle_ms_sleep() to use a mutex which is unique to idling
It seems that the prior use of sim_asynch_lock RECURSIVE mutex could cause a pthread_cond_timedwait() failure with EINVAL returned. As discussed in #595
This commit is contained in:
@@ -248,9 +248,9 @@ if (done_time.tv_nsec > 1000000000) {
|
||||
done_time.tv_sec += done_time.tv_nsec/1000000000;
|
||||
done_time.tv_nsec = done_time.tv_nsec%1000000000;
|
||||
}
|
||||
pthread_mutex_lock (&sim_asynch_lock);
|
||||
pthread_mutex_lock (&sim_idle_lock);
|
||||
sim_idle_wait = TRUE;
|
||||
stat = pthread_cond_timedwait (&sim_asynch_wake, &sim_asynch_lock, &done_time);
|
||||
stat = pthread_cond_timedwait (&sim_asynch_wake, &sim_idle_lock, &done_time);
|
||||
if (stat == 0)
|
||||
sim_asynch_check = 0; /* force check of asynch queue now */
|
||||
else
|
||||
@@ -264,7 +264,7 @@ else
|
||||
abort ();
|
||||
}
|
||||
sim_idle_wait = FALSE;
|
||||
pthread_mutex_unlock (&sim_asynch_lock);
|
||||
pthread_mutex_unlock (&sim_idle_lock);
|
||||
if (!timedout) {
|
||||
AIO_UPDATE_QUEUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user