Path: utzoo!utgpu!watserv1!watmath!att!att!rutgers!cs.utexas.edu!uunet!microsoft!dans From: dans@microsoft.UUCP (Dan SPALDING) Newsgroups: comp.os.os2.programmer Subject: Re: Counting semaphores? Message-ID: <58751@microsoft.UUCP> Date: 3 Nov 90 20:05:14 GMT References: <90Oct26.163804edt.8236@orasis.vis.toronto.edu> <1610001@hpcc01.HP.COM> Reply-To: dans@microsoft.UUCP (Dan SPALDING) Organization: Microsoft Corp., Redmond WA Lines: 12 In article <1610001@hpcc01.HP.COM> tomj@hpcc01.HP.COM (Tom Johnson) writes: >>>> Is it possible to set up a system semaphore that must be cleared as many >>> times as it has been set in order for a waiting thread to become >runnable? >> >>>I always thought that's the way RAM semaphores were implemented? > What you want to use is the Fast Safe Ram semaphores or named (system) semaphores. Both of them will implement counting and won't release some thread waiting on the semaphore until the count reaches zero. However, the same process can request the semaphore if it already owns it (in the same thread) and it just bumps the count.