Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Novlib 3.30 Online Reference - <b> semvalueget()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SemValueGet()
------------------------------------------------------------------------------
 Purpose:
 Get the value of a semaphore.

 Syntax:
 iValue = SemValueGet( dwSemID )

 Parameters:
 dwSemID The semaphore ID number.

 Returns:
 A numeric value in the range -127 to 127 (signed short int).

 The CA-Clipper name for this function is:
 SemValGet()

 Description:
 SemValueGet() returns the value of the semaphore specified by ID number
 dwSemID. Normal values returned are in the range -127 to 127.

 If SemValueGet() 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 = SemValueGet( 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: SemValueIncrement() SemValueDecrement() SemUserGet()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson