Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SIx Driver RDD v3.00 - Reference Guide - <b>sx_lockretry():</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Sx_LockRetry():

  Syntax:  Sx_LockRetry( [<nRetryVal>] )

           nRetryVal = Number of time to retry a record or file lock before
                       generating a timeout error.  The default value is 0
                       (Infinite retry).

  Returns:  Current retry value as a numeric.

  Description:  This function will set or retrieve the retry value when
                attempting to apply a record or file lock.  By default, an
                application will continue to try and apply the lock, unless
                this is set to some value.  If you want to set it to retry
                until it gets the lock, pass a zero (0) as the retry value.

  Example:

    #include "SIXCDX.CH"

    // Create a file-wide variable to hold our Error Block
    STATIC bDefError

    //---------------------------------------------------------------//
    FUNC main()

    LOCAL nCount := 0

    // Assign error block
    bDefError := ErrorBlock( { |e| LockErrHandler( e )})

    // Assuming TEST.DBF has a LAST.IDX file
    USE test INDEX last VIA "SIXCDX" SHARED

    // Generate an error after five tries at locking the index
    Sx_LockRetry(5)

    FOR nCount := 1 TO 1000
      dbSeek( "BogusValue" )        // Lookin' for EOF here!
    NEXT

    Return(NIL)

    //---------------------------------------------------------------//
    FUNC LockErrHandler( oErr )

    LOCAL cOldColor, cScrn

    // If retry count was reached, display message
    IF oErr:genCode == 680
      cScrn := SaveScreen( 11, 19, 13, 58 )
      cOldColor := SetColor("w+/r")
      @ 11,19 TO 13,58 DOUBLE
      @ 12,22 SAY "Index in use.  Waiting for lock..."
      Inkey(2)
      SetColor( cOldColor )
      RestScreen( 11, 19, 13, 58, cScrn )
      Return(.T.)
    ENDIF

    Return( Eval( bDefError, oErr ))



See Also: Sx_ROXLock() Sx_ROXUnLock() Sx_IsROXLock() Sx_IsMyROX()

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