[connect.audit] OS/2 Semaphores

duncanb@ibmpcug.co.uk (D G Booth) (01/10/90)

I would appreciate some advice on OS/2 semaphores. I am currently
designing a program that is going to be doing a lot of interprocess
communication primarily using shared memory. Obviously I need to use
semaphore locks around shared memory access.
 
First question:
 
Can I use a RAM semaphore in shared memory to control access between
processes, or must I use a `fast safe RAM semaphore'?
 
Second question:
 
As far as I can determine from the manuals, the OS/2 semaphores dont
actually provide me with `counting' semaphores. What I would like are
the two functions `Signal' and `Wait'.
Signal:	If there is anything blocked on the semaphore unblock it
	otherwise increment the count.
Wait:	If the count is 0 then block the thread, else decrement the
	count.
 
How do I get these two operations using OS/2 semaphores?
-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.
-- 
---
Duncan Booth, RCP Ltd.                    Didcot, Oxon, UK
duncanb@ibmpcug.co.uk                     Bix: jrichards