
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Novlib 3.30 Online Reference - <b> semvalget()</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SemValGet()
------------------------------------------------------------------------------
Purpose:
Get the value of a semaphore.
Syntax:
iValue = SemValGet( dwSemID )
Parameters:
dwSemID The semaphore ID number.
Returns:
A numeric value in the range -127 to 127 (signed short int).
Description:
SemValGet() returns the value of the semaphore specified by ID number
dwSemID. Normal values returned are in the range -127 to 127.
If SemValGet() returns a negative value, this is not the value of the
semaphore, but the number of users waiting to use the semaphore.
Returns NOVERRINT if an error occurs.
Example:
// To open a semaphore called "UPDATE_SEM" and examine its value:
dwSemID = SemOpen( "UPDATE_SEM", 24 )
if ( NWErrorGet() = 0 )
iCurrVal = SemValGet( dwSemID ) // Sample: 24
do case
case iCurrVal != NOVERRINT
? "The current semaphore value is", iCurrVal
case iCurrVal < 0
? iCurrVal * (-1)
?? " users are waiting to use the semaphore"
otherwise
? "Error"
endcase
endif
Notes:
Note for CA-Clipper:
IMPORTANT - both positive and negative values are valid semaphore handles,
except the value NOVERRLONG. Valid semaphore handles can be in the range
-2147483647 to +2147483647.
See Also: SemValInc() SemValDec() SemUsrGet()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson