Subj : Re: Consistency of a byte shared variable To : comp.programming.threads From : Joseph Seigh Date : Tue Feb 01 2005 07:32 am On Tue, 1 Feb 2005 01:32:27 -0800, SenderX wrote: >> Could the example "ever" abort in B3 under the POSIX memory visibility >> rules? > > I currently assume POSIX lays out a memory model based on stringent > acquire/release semantics: > > > sem_post( ... ) == release barrier "before" sema inc is made visible > > > sem_wait( ... ) == acquire barrier "after" sema dec is made visible > > > Does POSIX standard "explicitly" guarantee this type of straight forward > memory model? If so, where is it documented? > Posix doesn't explicity guarantee anything. Posix decided not to formally document any memory visibility semantics. Remember? Semaphores probably do have acquire/release semantics. If you subscribe to the notion that you need to use a mutex anyway, sem_post becomes pretty useless in a signal handler. And somebody will have to write a "Single Producer - Single Consumer with Semaphores is Broken" declaration. -- Joe Seigh .