X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fhardban.phh;h=1dd4b4eb1df4d70bafe2e5d9cfcb52e62918fc5a;hb=525cfe7d868bfaefdde9f769f52a50bcb6f1e9e9;hp=477a410f5f0a3805c4541a356c1895310f01cd1b;hpb=6a7088b090b78123ccfaa3ba00e1ea81647b173c;p=brisk.git diff --git a/web/Obj/hardban.phh b/web/Obj/hardban.phh index 477a410..1dd4b4e 100644 --- a/web/Obj/hardban.phh +++ b/web/Obj/hardban.phh @@ -240,19 +240,13 @@ class Hardbans { static function lock_data($is_exclusive) { - if (($tok = @ftok(FTOK_PATH."/hardbans", "B")) == -1) { - return (FALSE); - } - // echo "FTOK ".$tok."
"; - if (($res = sem_get($tok, ($is_exclusive ? 1 : LOCK_SHARE_MAX) )) == FALSE) { - return (FALSE); - } - if (sem_acquire($res)) { - self::$delta_t = microtime(TRUE); - log_lock("LOCK hardbans [".self::$delta_t."]"); - return ($res); - } - else + if (($res = file_lock(FTOK_PATH."/hardbans", $is_exclusive)) != FALSE) { + self::$delta_t = microtime(TRUE); + log_lock("LOCK hardbans [".self::$delta_t."]"); + + return ($res); + } + return (FALSE); } @@ -262,7 +256,7 @@ class Hardbans { log_lock("UNLOCK hardbans [".(microtime(TRUE) - (self::$delta_t))."]"); - return (sem_release($res)); + file_unlock($res); }