X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fbriskin5.phh;h=78d57665eed91f4fdab26f7be053a5a4c5e74705;hb=3f6352c51674328bc903e5444ec97ad34ae7c8d8;hp=eef465f61618a47148d60062fbaf9354ad16a96e;hpb=4bc2315c5b35234428050da6774d8ed6da9daa86;p=brisk.git diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index eef465f..78d5766 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -528,12 +528,12 @@ class Bin5_user extends User { break; if (file_exists(BIN5_PROXY_PATH) == FALSE) - mkdir(BIN5_PROXY_PATH); + mkdir(BIN5_PROXY_PATH, 0775, TRUE); if (($fp = @fopen(BIN5_PROXY_PATH."/".$sess.".step", 'rb')) == FALSE) break; if (($s = fread($fp, 8)) == FALSE) break; - if (strlen($s) != 8) + if (mb_strlen($s, "ASCII") != 8) break; $arr = unpack('Ls/Li', $s); fclose($fp); @@ -679,6 +679,8 @@ class Bin5_user extends User { class Bin5 { + static $delta_t = array(); + var $user; var $table; var $comm; // commands for many people @@ -945,7 +947,7 @@ class Bin5 { { GLOBAL $sess; - log_lock("LOCK_DATA ".FTOK_PATH."/bin5/table".$table_idx."/table"); + log_main("lockinfo: DATA ".FTOK_PATH."/bin5/table".$table_idx."/table"); // echo "LOCK: ".FTOK_PATH."/main"; // exit; // WARNING monitor this step @@ -957,20 +959,25 @@ class Bin5 { return (FALSE); } if (sem_acquire($res)) { - log_lock("LOCK table ".$table_idx."[res: ".$res."]"); - return ($res); + self::$delta_t[$table_idx] = microtime(TRUE); + log_lock("LOCK table [".$table_idx."] [".self::$delta_t[$table_idx]."]"); + + return (new Vect(array('res' => $res, 'tab' => $table_idx))); } else { - log_lock("LOCK table ".$table_idx.":FAILED"); - return (FALSE); + log_lock("LOCK table ".$table_idx.":FAILED"); + return (FALSE); } } - function unlock_data($res) + function unlock_data($res_vect) { GLOBAL $sess; - - log_lock("UNLOCK table [res: ".$res."]"); + + $res = $res_vect->getbyid('res'); + $tab = $res_vect->getbyid('tab'); + + log_lock("UNLOCK table [".$tab."] [".(microtime(TRUE) - (self::$delta_t[$tab]))."]"); return (sem_release($res)); } @@ -1153,12 +1160,12 @@ class Bin5 { $fp = FALSE; do { if (file_exists(BIN5_PROXY_PATH) == FALSE) - mkdir(BIN5_PROXY_PATH); + mkdir(BIN5_PROXY_PATH, 0775, TRUE); if (($fp = @fopen(BIN5_PROXY_PATH."/garbage_time.expired", 'rb')) == FALSE) break; if (($s = fread($fp, 4)) == FALSE) break; - if (strlen($s) != 4) + if (mb_strlen($s, "ASCII") != 4) break; $arr = unpack('Le', $s); if ($arr['e'] > $tm) @@ -1177,7 +1184,7 @@ class Bin5 { { do { if (file_exists(BIN5_PROXY_PATH) == FALSE) - mkdir(BIN5_PROXY_PATH); + mkdir(BIN5_PROXY_PATH, 0775, TRUE); if (($fp = @fopen(BIN5_PROXY_PATH."/garbage_time.expired", 'wb')) == FALSE) break; fwrite($fp, pack("L",$tm));