Subj : Re: Can you limit the number of Posts to a POSIX semaphore? To : comp.programming.threads From : Frank J. Lhota Date : Wed Aug 10 2005 02:35 pm David Schwartz wrote: > "Frank J. Lhota" wrote in message > news:jjvIe.14425$2y2.11099@trndny02... > >>I'm looking into porting a Win32 program to Linux. This program makes use >>of the fact that a Win32 semaphore is created with both an initial value >>and a maximum value. For example, >> >> hSem = CreateSemaphore (NULL, 1, 3, NULL); > > > I would use a mutex, condition variable, and count value to create a > semaphore with the exact semantics you want. It's not at all difficult. How about a pair of POSIX semaphores, one whose value is the number is seizes that can be performed, the other is the number of releases that can be performed? > DS > > -- "All things extant in this world, Gods of Heaven, gods of Earth, Let everything be as it should be; Thus shall it be!" - Magical chant from "Magical Shopping Arcade Abenobashi" "Drizzle, Drazzle, Drozzle, Drome, Time for the this one to come home!" - Mr. Lizard from "Tutor Turtle" .