Difference between revisions of "FLOCK()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to lock file
 
Function to lock file
 
  
 
==Syntax==
 
==Syntax==
 
FLOCK([<workarea | alias>])
 
FLOCK([<workarea | alias>])
 
  
 
==See Also==
 
==See Also==
[[ACCESS()]], [[LOCK()]], [[LOCKF]], [[LOCKR]], [[RLOCK()]], [[SET EXCLUSIVE]], [[USE]]
+
[[ACCESS()]], [[LOCK()]], [[RLOCK()]], [[SET EXCLUSIVE]], [[USE]]
 
+
  
 
==Description==
 
==Description==
 
The FLOCK() function attempts to logically lock the currently selected table.  If successful, it returns .T. and the table is locked.  If the table is already locked by another user, it returns .F.  If the optional <workarea | alias> name is specified the function will operate in the required location.  The FLOCK() function does NOT change the open status of the table to 'exclusive'.
 
The FLOCK() function attempts to logically lock the currently selected table.  If successful, it returns .T. and the table is locked.  If the table is already locked by another user, it returns .F.  If the optional <workarea | alias> name is specified the function will operate in the required location.  The FLOCK() function does NOT change the open status of the table to 'exclusive'.
 
The Recital/4GL performs automatic record locking, which makes the use of the FLOCK() function unnecessary.  The commands that require EXCLUSIVE use of the table are MODIFY STRUCTURE, REINDEX, PACK, INDEX ON <exp> TAG, and ZAP.  For reasons of safety, the INDEX command should also be used only with exclusive use of the table.
 
 
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
 
do while not flock()
 
do while not flock()
    @23,0 say "Database in use. please wait."
 
 
     sleep 2
 
     sleep 2
 
enddo
 
enddo
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Manual Locking]]
+
[[Category:Cursor Functions]]
[[Category:Manual Locking Functions]]
+

Latest revision as of 07:47, 4 February 2013

Purpose

Function to lock file

Syntax

FLOCK([<workarea | alias>])

See Also

ACCESS(), LOCK(), RLOCK(), SET EXCLUSIVE, USE

Description

The FLOCK() function attempts to logically lock the currently selected table. If successful, it returns .T. and the table is locked. If the table is already locked by another user, it returns .F. If the optional <workarea | alias> name is specified the function will operate in the required location. The FLOCK() function does NOT change the open status of the table to 'exclusive'.

Example

do while not flock()
    sleep 2
enddo