Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- dBsee 4.6 - The Library - <b>ddfilelock()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ddFileLock()
Semaphore on a dbDD file
------------------------------------------------------------------------------
Syntax:

     ddFileLock( <cNetOpe>, <cFile> ) --> NIL

Parameters:

     <cNetOpe>  Operation to be performed
     #include "dfNet.ch"
     +-------------------------+
     | Operation     |   Val   |
     |---------------+---------|
     | DD_LOCK       |  "lok"  |
     | DD_UNLOCK     |  "unl"  |
     | DD_CHECK      |  "chk"  |
     +-------------------------+
     <cFile>    dbDD file

Returns:

     NIL

Description:

     Defines a semaphore a a dbDD file
     
     NB. The function will NOT return until it succeeds in LOCKing the file

Example:

     // In this way can create a unique code
     // and nobody can make the same because I use
     // a flag on the DBDD
     
     // ddFileLock is a waiting function
     // the program wait until is able to make the
     // operation
     // For example with ddFileLock( DD_LOCK  , "Cli" )
     // wait until is able to lock the Cli record
     // on the DBDD
     
     // Lock of the vie using the DBDD
     ddFileLock( DD_LOCK  , "Cli" )
     
     IF Cli->(DFS(1,"0001")) // Seek on Cli
        Cli->(DBDELETE())       // Delete
     ENDIF
     
     // UnLock of the DBDD file
     ddFileLock( DD_UNLOCK, "Cli" )

See also:

     dfFileLock(), dfNet()

See Also: dfFileLock() dfNet()

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