Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!usc!ucsd!dog.ee.lbl.gov!ux1.lbl.gov!kushner From: kushner@ux1.lbl.gov (Gary Kushner) Newsgroups: comp.os.os2.programmer Subject: Re: Counting SEMs in OS/2?!? Keywords: private System-SEM's Message-ID: <8341@dog.ee.lbl.gov> Date: 2 Dec 90 00:02:15 GMT References: <8201@dog.ee.lbl.gov> Sender: usenet@dog.ee.lbl.gov Reply-To: kushner@ux1.lbl.gov (Gary Kushner) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 16 X-Local-Date: Sat, 1 Dec 90 16:02:15 PST >private system semaphores (DosCreateSem with parameter CSEM_PRIVATE) have to be >cleared as many times as they have been set. The reason for this was that you >should be able to write recursive functions that request ownership of a >resource in each recursion level and free the resource every time they 'return'. Actually what I meant was more like the traditional P and V operations. I wanted to be able to initialize a SEM to a count and then have threads be able to P (request) the sem as many times as the original count. Used for controlling resources that can have more than one and less than all users. It turned out the code to implement counting semaphores in OS/2 was quite trivial. It is just to bad that Microsoft didn't include them in the first place. -Gary