[BUSH User Guide]
 
Home Page Introduction Tutorials Reference Packages Hacking
 
  Packages  
4.1 Using Packages
4.2 text_io (Console I/O)
4.3 text_io (File I/O)
4.4 sound
4.5 source_info
4.6 System
4.7 numerics
4.8 strings
4.9 command_line
4.10 lock_files
4.11 cgi
4.12 calendar
4.13 units
4.14 arrays
4.15 files
4.16 db (Database)
4.17 stats
4.18 pen
4.19 mysql
4.20 os
4.21 directory_operations
 
This part of the guide contains detailed descriptions of the BUSH built-in packages.
 

4.10 lock_files Package

A lock file is a file that, if it exists, indicates that a particular resource is in use. The lock_files package contains procedures to create and destroy lock files under any operating system. If a lock file cannot be locked, an error is reported.

GCC Ada Equivalent: GNAT.Lock_Files
 


lock_files.lock_file( [dir,] file, [, wait [, retries] ] )

create a lock file named file in optional directory dir.  Retry up to retries (natural) times, waiting for wait (duration) seconds between retries. Default for wait/retries in 1.0 second and almost forever.
Example: lock_files.lock_file( "test_lock.lck" );
Ada Equivalent: GNAT.Lock_Files.Lock_File
Parameters:
dir in string "." the directory to place the lock file in
file in string required the name of the lock file
wait in duration 1.0 the number of seconds to wait between retries
retries in natural largest natural the maximum number of retries

If the file cannot be locked, BUSH reports an error.


lock_files.unlock_file( [dir,] file )

delete the lock file name file in optional directory dir.
Example: lock_files.unlock_file( "test_lock.lck" );
Ada Equivalent: GNAT.Lock_Files.Unlock_File
Parameters:
dir in string "." the directory the lock file is in
file in string required the name of the lock file

 Back to Top