mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
Forward port r123 from branches/5.0:
Replace goto in os_event_wait with a normal loop.
This commit is contained in:
parent
1cae280896
commit
86e48ce5f9
1 changed files with 16 additions and 16 deletions
32
os/os0sync.c
32
os/os0sync.c
|
@ -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);
|
||||
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
|
||||
|
||||
os_thread_exit(NULL);
|
||||
}
|
||||
/* Ok, we may return */
|
||||
|
||||
return;
|
||||
}
|
||||
/* Ok, we may return */
|
||||
|
||||
return;
|
||||
pthread_cond_wait(&(event->cond_var), &(event->os_mutex));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* 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 */
|
||||
|
||||
goto loop;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue