Re: gthread-win32.c
- From: "Dan Maas" <dmaas dcine com>
- To: "Steven Brooks" <umbrook0 cs umanitoba ca>, "Kaz Kylheku" <kaz ashi footprints net>
- Cc: <gtk-devel-list gnome org>
- Subject: Re: gthread-win32.c
- Date: Tue, 15 May 2001 20:08:41 -0400
> On NT, we could use SignalObjectAndWait:
> g_cond_wait(cond, mutex)
> 1. lock cond->mutex
> 2. add this thread to cond->queue
> 3. release cond->mutex
> 4. SignalObjectAndWait(mutex, this_thread->event, INFINITE,
> FALSE)
> 5. lock mutex
>
> There is a race condition between 4 and 5, but looking at the SUSv2, it
> looks like a non-guaranteed area.
I don't think the re-lock needs to be atomically paired with the wakeup as
long as you permit spurious wakeups (which are certainly allowed with
pthreads, so pthreads apps already handle this case).
In fact checking the sources for glibc 2.2.2 reveals that the last statement
in pthread_cond_wait() is indeed plain old pthread_mutex_lock() =)
Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]