php shmop windows 信号量锁

 1 if (!function_exists('sem_get')) {
 2     function sem_get($key) {
 3         return fopen(__FILE__ . '.sem.' . $key, 'w+');
 4     }
 5     function sem_acquire($sem_id) {
 6         return flock($sem_id, LOCK_EX);
 7     }
 8     function sem_release($sem_id) {
 9         return flock($sem_id, LOCK_UN);
10     }
11 }

 

posted @ 2018-04-07 21:24  狂猫  阅读(245)  评论(0编辑  收藏  举报