sem_getvalue patch revisited

Robert Collins
Sat Jun 29 00:36:00 GMT 2002

Actually neither of them are quite right.

Yours calls __sem_post, which is definately wrong.

Sam Robb's I've properly reviewed now, and it's also not quite there.

The file is nearly a waste of space at the moment. All recent
patches to it have been converting the call tree from foo (thing*     __foo (thing*        thing->foo

to foo (thing *      thing->foo

Sam's approach of reading the value directly is wrong (breaks
encapsulation), but your double bounce approach is also wasteful. And yes
there are many examples like that in the threads code, which I inherited and
have been (slowly) whittling away.


----- Original Message -----
From: "Darik Horn" <>
To: <>
Sent: Saturday, June 29, 2002 5:58 AM
Subject: sem_getvalue patch revisited

> Sam Robb posted a semaphore getvalue patch on June 7th, 2002:
> I had been working on the same problem, but I produced a different
> solution.  Please see the attachment, which was written against 1.3.10-1
> but also applies to 1.3.11-3 cleanly.
> In particular, Rob's patch returns `(*sem)->currentvalue` directly from
> inside the new __sem_ function, whereas my patch adds a GetValue method to
> the semaphore class.  (I was trying to follow the style of the existing
> Cygwin semaphore.)
> I am wondering whether Sam's patch is functionally equivalent to my own,
> and whether one is more or less correct than the other.
> []

More information about the Cygwin-patches mailing list