1
0
mirror of https://github.com/simh/simh.git synced 2026-01-25 19:56:25 +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:
Mark Pizzolato
2018-07-11 11:59:05 -07:00
parent 29a4fb9802
commit 484889ea5a
3 changed files with 7 additions and 3 deletions

View File

@@ -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;
}