This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH] new mutex implementation 2. posting
- From: Thomas Pfaff <tpfaff at gmx dot net>
- To: Robert Collins <rbcollins at cygwin dot com>
- Cc: cygwin-patches at cygwin dot com
- Date: Mon, 23 Sep 2002 08:25:38 +0200 (Westeuropäische Sommerzeit)
- Subject: Re: [PATCH] new mutex implementation 2. posting
On Sun, 22 Sep 2002, Robert Collins wrote:
> On Sat, 2002-09-21 at 01:47, Christopher Faylor wrote:
> > I haven't been following very closely. Is the reason why we are not using
> > critical sections that TryEnterCriticalSection isn't available anywhere?
> > If so, then we can probably fix that with some assembly programming.
> Thats a factor, yes.
> > Critical sections are *so* much faster than mutexes or semaphores that
> > it makes sense to use them if possible.
> > Or, maybe we're talking about something else entirely...
> Well there are two things. Thomas's work gives use recursive and error
> checking mutexes, which aren't currently supported. He also points out
> that semaphores leverage critical sections on NT, so should be ~ in
The third and most important point is that the current implementation is
not fork save. After a fork a mutex is recreated and its state is lost.
POSIX requires that the state is preserved. While this is not important
for locks that are hold by another thread all locks of the forking thread
should remain locked. IMHO this can not be done with kernel mutexes nor
with critical sections.