[PATCH] add support for PTHREAD_MUTEX_NORMAL

Robert Collins rbcollins@cygwin.com
Wed Mar 19 10:24:00 GMT 2003


On Wed, 2003-03-19 at 21:15, Thomas Pfaff wrote:

> > Enabled by default. Sure, as long as they aren't turned off again, or
> > someone builds without them to get 386 support... Please, use the
> > compatible test, it won't alter the code much. You can test for <0 and
> > >0 safely.
> 
> The mutex stuff does not work on i386 at all because it requires
> InterlockedCompareExchange. The reason to enable the Interlocked stuff in
> winbase.h was to keep cygwin running on Win95 that has no implementation
> for InterlockedCompareExchange. It simply can't be disabled without
> loosing support for Win95/NT3.5. All later Windows versions behave the
> same way than the inline ones, therefore it does not matter if the inlines
> were disabled again. Sure someone could only enable the inline
> InterlockedCompareExchange but why the hell he should do this.

Ah, I had missed that i386 was impossible no matter what. Ok, that use
is fine.

> > > > Secondly, IIRC lock_counter should be long, so the (long *) typecasting
> > > > isn't needed.
> > >
> > > IMHO it should be unsigned since it makes no sense to have negative
> > > counter values. In practice it doesn't make any difference because there
> > > are not greater or smaller equations in the code.
> >
> > It's about type safety. Please, correct it.
> 
> Why not create an InterlockedIncrement|Decrement that takes unsigned long
> arguments instead ? This has nothing to do with type safety but with lack
> of functions.

Either way, the typecast is not needed. Please either:
* make the variable long 
* make unsigned variants of the interlockedIncrement|Decrement that will
throw (not C++, rather a processor exception) overflow or underflow as
appropriate.

Rob
-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030319/394a62a5/attachment.sig>


More information about the Cygwin-patches mailing list