Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!rochester!cornell!uw-beaver!milton!yoda.eecs.wsu.edu!wbonner From: wbonner@eecs.wsu.edu (Wim Bonner) Newsgroups: comp.os.os2.programmer Subject: Re: Making a non exclusive semaphore (like on Unix) Keywords: semaphore, counter, exclusive Message-ID: <1991Mar11.234802.5436@eecs.wsu.edu> Date: 11 Mar 91 23:48:02 GMT References: <18131@milton.u.washington.edu> Reply-To: wbonner@yoda.UUCP (Wim Bonner) Organization: Washington State University, Pullman Lines: 19 In article <18131@milton.u.washington.edu> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >Is there any mechanisme similar to Unixes' semaphores, ie I'd like to get >a semaphore with units: > - one thread increments it (so never blocking) > - another thread uses units and gets blocked only when the counter is 0. >(it's for managing a packet layer window in a comm package). I know that when you use semaphores in OS/2, they are not really sspecified as to the way they are impleneted internally, but a DosSemWait will wait for the semaphore to be completely cleared. (Multple DosSemSet()'s seem to increment the counter, and you must use the same number of DosSemClear()'s to get the semaphore back to the original state.) A DosSemRequest will wait till the sem has been cleared, and then set it. Hope this helps... -- | wbonner@yoda.eecs.wsu.edu | | 27313853@wsuvm1.csc.wsu.edu | | 72561.3135@CompuServe.com |