This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add support for PTHREAD_MUTEX_NORMAL


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>.

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]