
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FORCE Data Base Compiler - ##############################################################################
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
##############################################################################
###+---------+################################################################
#+-| FLOCK() |------------------------------------+###########################
#| +---------+ Attempts to lock the current alias |###########################
#+------------------------------------------------+###########################
##############################################################################
##############################################################################
#+--| Summary |------------------+############################################
#| #INCLUDE database.hdr |############################################
#+-------------------------------+############################################
##############################################################################
##############################################################################
#+--| Syntax |------------------------------+#################################
#| FUNCTION LOGICAL flock PROTOTYPE |#################################
#+------------------------------------------+#################################
##############################################################################
##############################################################################
######+---| Description |----------------------------------------------+######
######| flock() attempts to lock the current alias. If the database |######
######| file is successfully locked, flock() returns TRUE. Any locks, |######
######| record or file assigned to the current alias are released and, |######
######| if flock() is unsuccessful, the locks are not restored. |######
######| -------------------------------------------------------------- |######
######| All files associated with the current alias are locked, |######
######| including index and memo files. |######
######+----------------------------------------------------------------+######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Lock a database prior to packing. |#########
#########| |#########
#########| DBFDEF names |#########
#########| CHAR(20) name |#########
#########| CHAR(20) addr |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| VARDEF |#########
#########| CHAR(1) ans |#########
#########| ENDDEF |#########
#########| |#########
#########| OPEN "f:\data\names.dbf" ALIAS names SHARED |#########
#########| ACCEPT "Pack database?" TO ans |#########
#########| IF "Yy" $ ans |#########
#########| IF .NOT. flock() |#########
#########| PACK |#########
#########| ELSE |#########
#########| ? "Unable to get database." |#########
#########| ? "Please try later..." |#########
#########| ENDIF |#########
#########| ENDIF |#########
#########| {...} |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Lock a database prior to using SUM. |#########
#########| |#########
#########| IF .NOT. flock() |#########
#########| RETURN .F. |#########
#########| ENDIF |#########
#########| |#########
#########| SUM ALL TO count_total |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also: a_flock() a_rlock() rlock() OPEN UNLOCK USE
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson