Commit 86e48ce5 authored by osku's avatar osku

Forward port r123 from branches/5.0:

Replace goto in os_event_wait with a normal loop.
parent 1cae2808
......@@ -317,28 +317,28 @@ os_event_wait(
os_fast_mutex_lock(&(event->os_mutex));
old_signal_count = event->signal_count;
loop:
if (event->is_set == TRUE
|| event->signal_count != old_signal_count) {
os_fast_mutex_unlock(&(event->os_mutex));
for (;;) {
if (event->is_set == TRUE
|| event->signal_count != old_signal_count) {
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
os_fast_mutex_unlock(&(event->os_mutex));
os_thread_exit(NULL);
}
/* Ok, we may return */
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
return;
}
os_thread_exit(NULL);
}
/* Ok, we may return */
pthread_cond_wait(&(event->cond_var), &(event->os_mutex));
return;
}
/* Solaris manual said that spurious wakeups may occur: we have to
check if the event really has been signaled after we came here to
wait */
pthread_cond_wait(&(event->cond_var), &(event->os_mutex));
goto loop;
/* Solaris manual said that spurious wakeups may occur: we
have to check if the event really has been signaled after
we came here to wait */
}
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment