You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by C K Tan <ck...@nxscientific.com> on 2003/10/28 07:36:07 UTC
[PATCH] apr win32 thread_cond
I ran into a race condition on Win32 with the attached test program
(pc.c). Looking at thread_cond.c, it became obvious where where this
could happen:
1. on line 96, apr_thread_mutex_unlock can be called multiple times
without corresponding lock operation (if the while loop executes more
than once).
2. on line 101 & 115, the ReleaseMutex calls do not have the prior lock
mutex.
I have not fixed apr_thread_cond_broadcast() which has the same bugs.
Also, apr_thread_cond_create does not register thread_cond_cleanup as
was done by the unix version.
Regards,
-cktan
Re: [PATCH] apr win32 thread_cond
Posted by Branko Čibej <br...@xbc.nu>.
C K Tan wrote:
> I ran into a race condition on Win32 with the attached test program
> (pc.c). Looking at thread_cond.c, it became obvious where where this
> could happen:
>
> 1. on line 96, apr_thread_mutex_unlock can be called multiple times
> without corresponding lock operation (if the while loop executes more
> than once).
> 2. on line 101 & 115, the ReleaseMutex calls do not have the prior
> lock mutex.
>
> I have not fixed apr_thread_cond_broadcast() which has the same bugs.
>
> Also, apr_thread_cond_create does not register thread_cond_cleanup as
> was done by the unix version.
There are more problems in the Win32 condition variable implementation.
I'm working on them, and hope to have a patch ready by the end of this week.
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/