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: sem_getvalue patch revisited


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 pthread.cc file is nearly a waste of space at the moment. All recent
patches to it have been converting the call tree from

pthread.cc: foo (thing*
thread.cc:     __foo (thing*
thread.cc:        thing->foo

to
pthread.cc: foo (thing *
thread.cc:      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.

Cheers,
Rob

----- Original Message -----
From: "Darik Horn" <dajhorn@uwaterloo.ca>
To: <cygwin-patches@cygwin.com>
Sent: Saturday, June 29, 2002 5:58 AM
Subject: sem_getvalue patch revisited


>
> Sam Robb posted a semaphore getvalue patch on June 7th, 2002:
>
> http://cygwin.com/ml/cygwin-patches/2002-q2/msg00339.html
>
> 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.
>
> []
>


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