Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-07-19 09:09:46


--- In boost_at_y..., "Alexander Terekhov" <terekhov_at_d...> wrote:
>
>
> boost::semaphore::up
> boost::semaphore::down
>
> vs large industry (IEEE/Open Group) consensus: lock/unlock..

Vs. the POSIX choice of post and wait.
 
> 3212 4.15 Semaphore
> 3213 A minimum synchronization primitive to serve as a basis for
more
> complex synchronization
> 3214 mechanisms to be defined by the application program.
> 3215 For the semaphores associated with the Semaphores option, a
semaphore
> is represented as a
> 3216 shareable resource that has a non-negative integer value. When
the
> value is zero, there is a
> 3217 (possibly empty) set of threads awaiting the availability of
the
> semaphore.
> 3218 For the semaphores associated with the X/Open System Interface
> Extension (XSI), a semaphore
> 3219 is a positive integer (0 through 32767). The semget( )
function can be
> called to create a set or array
> 3220 of semaphores. A semaphore set can contain one or more
semaphores up
> to an implementation-
> 3221 defined value.
>
> 3222 Semaphore Lock Operation
> ^^^^
>
> 3223 An operation that is applied to a semaphore. If, prior to the
> operation, the value of the
> 3224 semaphore is zero, the semaphore lock operation shall cause the
> calling thread to be blocked and
> 3225 added to the set of threads awaiting the semaphore; otherwise,
the
> value shall be decremented.
>
> 3226 Semaphore Unlock Operation
> ^^^^^^
>
> 3227 An operation that is applied to a semaphore. If, prior to the
> operation, there are any threads in
> 3228 the set of threads awaiting the semaphore, then some thread
from that
> set shall be removed from
> 3229 the set and becomes unblocked; otherwise, the semaphore value
shall be
> incremented.

This has been discussed before, and I won't rehash most of it again.
The long and short, whether these are the accepted industry names or
not, lock and unlock are meaningless terms when the semantics are to
increment and decrement a value.

> btw..

[very long text from the POSIX documentation snipped]

There's a lot here, and you don't indicate precisely what you are
intending to convey, so I can't comment.
 
> 39299 sem_post -unlock a semaphore (REALTIME)
> ^^^^^^

Yes, but notice the name chosen ;). Post and Wait, Release and Wait,
as well as the traditional P and V were all also considered, and
rejected.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk