[comp.bugs.sys5] semaphore semantics

dave@micropen (David F. Carlson) (11/08/88)

A program of mine uses a unique semaphore for shared resource control.
Processes start and stop asynchronously and HAD been doing a 
semctl(..., IPC_RMID,...) to remove the ID on last close as one might do with
a lock file using the UNIX file system semantics.  The problem is that under
System V r3.0, the IPC_RMID doesn't wait until the last close but removes
the semaphore *immediately* AND all subsequent operations fail (correctly!!!)
with errno=ERMID.

This seems to violate other UNIX "shared-resources-that-are-removed"
conventions like unlink on last close.

As this appears to be how SV does things, how does one let the last process
remove the ID?  There appears to be no semctl that gives the number of active
processes like shmctl field shm_nattch.  Any shots would be appreciated.

-- 
David F. Carlson, Micropen, Inc.
micropen!dave@ee.rochester.edu

"The faster I go, the behinder I get." --Lewis Carroll