示例#1
0
 public static function synExecute($hint_str, $critialFunc)
 {
     //lock file
     $handle = fopen(ConfigManager::getOGameMutexFileName(), "r+");
     while (!flock($handle, LOCK_EX)) {
         sleep(1);
     }
     echo "\n== " . $hint_str . " Syn Start ==\n\n";
     //critical section
     $result = $critialFunc();
     echo "\n==Syn end==\n";
     flock($handle, LOCK_UN);
     fclose($handle);
     return $result;
 }