Trouble using semctl

Neil Dunstan ndunstan at gara.une.oz.au
Tue Feb 26 10:27:23 AEST 1991


semctl( semarray_id, 0, GETNCNT, 0 ) sometimes returns 0 unexpectedly.

I'm using it in a loop to test when a process has been released from a semaphore
queue. i.e.

oldcount = semctl( semarray_id, 0, GETNCNT, 0 )
while( (newcount = semctl( semarray_id, 0, GETCNT, 0 )) != oldcount-1 )
	semop( ... /* increase semaphore value by one */

Does anyone know why this shouldn't work?

Thanks.
Newsgroups: comp.unix.internals
Subject: Problem with semctl
Expires: 
References: 
Sender: 
Reply-To: neil at neumann.une.oz (Neil Dunstan)
Followup-To: 
Distribution: world
Organization: University of New England, Armidale, Australia
Keywords: 

semctl( semarray_id, 0, GETNCNT, 0 ) sometimes returns 0 unexpectedly.

I'm using it in a loop to test when a process has been released from a semaphore
queue. i.e.

oldcount = semctl( semarray_id, 0, GETNCNT, 0 )
while( (newcount = semctl( semarray_id, 0, GETCNT, 0 )) != oldcount-1 )
	semop( ... /* increase semaphore value by one */

Does anyone know why this shouldn't work?

Thanks.



More information about the Comp.unix.internals mailing list