apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaus Keppler <klaus.kepp...@informatik.stud.uni-erlangen.de>
Subject [PATCH] RESEND: fixing condvar bug under WIN32
Date Sat, 28 Aug 2004 16:58:07 GMT
Hello!

As I already mentioned many many many weeks ago, the implementation
of condition variables under WIN32 has at least one nasty bug which
may lead to a deadlock
(see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27654)

In my application which uses APR I really *do* experience this
deadlock unless I apply the patch (see attachment) to
locks/win32/thread_cond.c

The problem is that the current loop implementation of
apr_thread_cond_(timed)wait calls apr_thread_mutex_unlock
multiple times (which is certainly not ok).
If you then have a look at apr_thread_mutex_unlock, you
see that it calles the WIN32 API function "LeaveCriticalSection".

To quote the MSDN documentation on LeaveCriticalSection:
---snip---
[...]
If a thread calls LeaveCriticalSection when it does not have
ownership of the specified critical section object, an error
occurs that may cause another thread using EnterCriticalSection
to wait indefinitely.
[...]
---snip---

So *please* *please* *please* consider the attached patch for
APR-1.0.0 - otherwise conditional variables will shurely not work
under WIN32.
The patch is not very big, should be easy to understand and doesn't
affect any other portion of APR.

If you're not interested in that, please let me know the reason.
Sending patches and receiving *no* reply doesn't make happy. ;-)

Bye,

Klaus

Mime
View raw message