[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FN_SEMEX()
 Examine a semaphore's value and open count
------------------------------------------------------------------------------
 Syntax
 
       fn_semEx( <nHandle>, <@nValue>, <@nOpenCnt> ) -> nRc
 
 Arguments

      <nHandle> is the semaphore handle, returned from a previous call
      to fn_semOpen().

      <@nValue> will get the current semaphore value.  THIS NUMERIC
      ARGUMENT MUST BE PASSED BY REFERENCE!

      <@nOpenCnt> will get the current number of workstations
      that have opened the semaphore.  THIS NUMERIC ARGUMENT MUST BE
      PASSED BY REFERENCE!

 Returns

      nRc, a numeric, as follows:

            0 - success
          255 - invalid semaphore handle

      In addition, nValue will be set to the semaphore's current value,
      and nOpenCnt will be set to the number of stations that have
      opened the semaphore.

 Description

      See the description for fn_semOpen().

 Examples

    nInitVal := 2
    nHandle  := 0
    nOpenCnt := 0

    fn_semOpen( "Semaphore Test", nInitVal, @nHandle, @nOpenCnt )

    nRc := fn_semWait( nHandle )
        IF nRc == 254
       QOUT( "All slots for this resource are currently in use" )
       QUIT
    ENDIF

    fn_semEx( nHandle, @nValue, @nOpenCnt )
    QOUT( "Semaphore test -> Open at [" + ;
          ALLTRIM(STR(nOpenCnt))        + ;
          "] stations, value is ["      + ;
          ALLTRIM(STR(nValue)) + "]" )

 Source: N:\SRC\SYNCHRO\SEMA.PRG

 Author: Glenn Scott

See Also: FN_SEMOPEN() FN_SEMWAIT() FN_SEMSIG() FN_SEMCLOS()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson