8
function __construct($name) {
12
$dir = $TMP_PATH . "/locks";
15
if (!@mkdir($dir, 0755, true))
16
throw new ADEIException(translate("It is not possible to create lock directory \"$dir\""));
19
if ($SETUP) $fname = $dir . "/${SETUP}__${name}.lock";
20
else $fname = $dir . "/ADEI__${name}.lock";
22
$this->lockf = @fopen($fname, "a+");
24
throw new ADEIException(translate("It is not possible to create lock file \"$fname\""));
27
function __destruct() {
31
function Lock($flag = 0, $errmsg = false) {
32
if ($flag&LOCK::BLOCK) {
33
$res = flock($this->lockf, LOCK_EX);
35
if ($errmsg) throw new ADEIException($errmsg);
36
else throw new ADEIException(translate("Locking is failed"));
39
$res = flock($this->lockf, LOCK_EX|LOCK_NB);
40
if ((!$res)&&($errmsg)) throw new ADEIException($errmsg);
47
flock($this->lockf, LOCK_UN);
b'\\ No newline at end of file'