[Prev: LOCKFILE][Resources][TOC][Next: LOCKTRIES]

LOCKMETHOD


Syntax

Envariable

M2H_LOCKMETHOD=method

Element

<LOCKMETHOD>
method
</LOCKMETHOD>

Command-line Option

-lockmethod method


Description

LOCKMETHOD determines how MHonArc should lock archives to protect multiple MHonArc processes modifying an archive at the same time. If after reading this page you still are unsure on what method to use, or do not understand some of the material, then just stick with the default value.

The following is a list of possible values for LOCKMETHOD:

directory

MHonArc uses a directory file in the archive directory to lock an archive. When MHonArc is to access/modify an archive, it will first try to create a directory in the archive directory with a name determined by the LOCKFILE resource. MHonArc will try LOCKTRIES times to create the directory (obtains the lock) before timing out.

flock

MHonArc will use Perl's flock() operator. LOCKFILE will be created in the archive directory if does not already exist. Then MHonArc will try to LOCKTRIES times to obtain an exclusive lock on the file via flock() before timing out.

WARNING

Each locking method is incompatible with each other. Therefore, make sure the same method is specified for all MHonArc processes that will be accessing a given archive. If you want to change the default lock method so it will affect all MHonArc processes, you can set it via the default resource file or through mhasiteinit.pl. See Post Installation Configuration for more information.

The following sub-sections give more information of each lock method, including the pros and cons of each, and assumes you have some knowledge about file systems.

Directory File Method

The directory file method is the default method used by MHonArc, and is the method used by past version of MHonArc. If you are familiar with locking methods used by other software, you may find it strange that a directory (which is just a special kind of file) is used instead of a plain file. The reason a directory is used is that it has unique properties over regular files on the various operating systems MHonArc runs on. The property that MHonArc takes advantage of is that you cannot create a new directory over an existing directory of the same name. This property is not guaranteed for plain files, or at least Perl cannot give a common interface for plain files to work on all platforms. It may be possible to use a plain file with Perl's sysopen() operator with the proper options, but the needed sysopen() options are not guaranteed to be available for all ports of Perl.

Pros

Cons

flock Method

Using flock() is a common method for locking files under Unix-type operating systems. In order to use flock() method, the Symbol and Fcntl Perl modules must be available. If not available, and this method is specified, MHonArc will fallback to the directory file method.

Unlike the directory method, it is okay if LOCKFILE stays around, and actually, it should never be manual deleted.

Pros

Cons


Default Setting

directory

NOTE

The use of <LOCKMETHOD> within an RCFILE will take affect ONLY if used in the DEFRCFILE.

WARNING

Each locking method is incompatible with each other. Therefore, make sure the same method is specified for all MHonArc processes that will be accessing a given archive. If you want to change the default lock method so it will affect all MHonArc processes, you can set it via the default resource file or through mhasiteinit.pl. See Post Installation Configuration for more information.


Resource Variables

N/A


Examples

None.


Version

2.4.0


See Also

FORCE, LOCK, LOCKDELAY, LOCKFILE, LOCKTRIES


[Prev: LOCKFILE][Resources][TOC][Next: LOCKTRIES]

$Date: 2003/10/06 22:04:18 $
MHonArc
Copyright © 1999, Earl Hood, mhonarc@mhonarc.org