Re: gthread-win32.c
- From: "Dan Maas" <dmaas dcine com>
- To: "Steven Brooks" <umbrook0 cs umanitoba ca>, "Sebastian Wilhelmi" <wilhelmi ira uka de>
- Cc: "gtk-devel-list" <gtk-devel-list gnome org>, "Kaz Kylheku" <kaz ashi footprints net>
- Subject: Re: gthread-win32.c
- Date: Tue, 22 May 2001 14:23:16 -0400
> 227 g_mutex_unlock (entered_mutex);
> 228
> 229 win32_check_for_error (WAIT_FAILED !=
> 230 (retval = WaitForSingleObject (event, milliseconds)));
> 231
> 232 wilhelmi 1.1 g_mutex_lock (entered_mutex);
>
>
> Lines 227-230 should be ObjectSignalAndWait, if supported.
Yes this is what we were discussing earlier... Lines 227 and 230 should be
atomic, otherwise a wakeup could arrive between them, and the thread would
sleep anyway.
As Steven said, you could detect Windows NT at startup and just use
SignalObjectAndWait() here... Actually, I wonder if it might be possible to
avoid lost wakeups if the per-thread 'event' is a manual-reset event instead
of an auto-reset event... With a manual-reset event it wouldn't matter if
the cond_broadcast/cond_signal came before this thread's
WaitForSingleObject(), because the event would remain signalled...
Regards,
Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]