當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sem_remove函數代碼示例

本文整理匯總了PHP中sem_remove函數的典型用法代碼示例。如果您正苦於以下問題:PHP sem_remove函數的具體用法?PHP sem_remove怎麽用?PHP sem_remove使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了sem_remove函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: unlock

 /**
  * @return bool
  */
 public function unlock()
 {
     $released = sem_release($this->lock);
     sem_remove($this->lock);
     $this->lock = null;
     return $released;
 }
開發者ID:CrakLabs,項目名稱:ipc-component,代碼行數:10,代碼來源:SmLock.php

示例2: testfailRemovingSemaphore

 /**
  * Tests removing semaphore fails.
  *
  * @test
  * @expectedException bandwidthThrottle\tokenBucket\storage\StorageException
  * @expectedExceptionMessage Could not remove semaphore.
  */
 public function testfailRemovingSemaphore()
 {
     $key = ftok(__FILE__, "a");
     $storage = new IPCStorage($key);
     sem_remove(sem_get($key));
     @$storage->remove();
 }
開發者ID:bandwidth-throttle,項目名稱:token-bucket,代碼行數:14,代碼來源:IPCStorageTest.php

示例3: store

 public static function store($key, $value)
 {
     self::getHandle();
     if (!shm_put_var(self::$handle, self::getVarKey($key), $value)) {
         sem_remove(self::$semaphore);
         shm_remove(self::$handle);
         die('couldn\'t write to shared memory.');
     }
     self::release();
 }
開發者ID:mikejw,項目名稱:elib-base,代碼行數:10,代碼來源:Stats.php

示例4: drop

 function drop($key)
 {
     try {
         return sem_remove($this->locks[$key]);
     } catch (ExecutionContextException $e) {
         unset($this->locks[$key]);
         // already race-removed
         return false;
     }
 }
開發者ID:phoebius,項目名稱:proof-of-concept,代碼行數:10,代碼來源:SysVLocker.class.php

示例5: remove

 public function remove()
 {
     if (!shm_remove($this->memory)) {
         throw new StorageException("Could not release shared memory.");
     }
     $this->memory = null;
     if (!sem_remove($this->semaphore)) {
         throw new StorageException("Could not remove semaphore.");
     }
     $this->semaphore = null;
 }
開發者ID:hyperunknown,項目名稱:token-bucket,代碼行數:11,代碼來源:IPCStorage.php

示例6: drop

 public function drop($key)
 {
     if (isset($this->pool[$key])) {
         try {
             return sem_remove($this->pool[$key]);
         } catch (BaseException $e) {
             unset($this->pool[$key]);
             // already race-removed
             return false;
         }
     }
     return null;
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:13,代碼來源:SystemFiveLocker.class.php

示例7: delete

 function delete()
 {
     if ($this->shm) {
         sem_acquire($this->sem());
         try {
             $this->shm->delete();
             sem_release($this->sem());
         } catch (Exception $e) {
             sem_release($this->sem());
         }
     }
     $this->logger->debug(sprintf("Delete semaphore (key: 0x%08x)", $this->semKey));
     sem_remove($this->sem());
     if (isset($e)) {
         throw $e;
     }
 }
開發者ID:sacredwebsite,項目名稱:scalr,代碼行數:17,代碼來源:ShmArray.php

示例8: setUniqueValue

 function setUniqueValue($value, $user, $userid = 0)
 {
     $conn = create_db_connection();
     $key = md5($value . ":unique-value:" . $user);
     $sem = 0;
     if (function_exists("sem_get")) {
         $sem = sem_get(ftok(realpath("config/upload.php"), 'R'));
         sem_acquire($sem);
     }
     $conn->openselect("select * from " . getUserConfig("dbprefix") . "uniquevalues where md5='" . $key . "' and user='" . $conn->escape($user) . "' and userid=0" . intval($userid));
     if ($conn->eof()) {
         $conn->execute("insert into " . getUserConfig("dbprefix") . "uniquevalues(md5,util,user,userid) values('" . $conn->escape($key) . "','" . $conn->escape($value) . "','" . $conn->escape($user) . "',0" . intval($userid) . ")");
     } else {
         resetUniqueValue($key, $value, $user, $userid);
     }
     if ($sem) {
         sem_release($sem);
         sem_remove($sem);
     }
     $conn->close();
     return $key;
 }
開發者ID:jawedkhan,項目名稱:rorca,代碼行數:22,代碼來源:upload.php

示例9: release

 /**
  * Release the lock
  *
  * @return	boolean		Returns TRUE on success or FALSE on failure
  */
 public function release()
 {
     if (!$this->isAcquired) {
         return TRUE;
     }
     $success = TRUE;
     switch ($this->method) {
         case 'simple':
             if (unlink($this->resource) == FALSE) {
                 $success = FALSE;
             }
             break;
         case 'flock':
             if (flock($this->filepointer, LOCK_UN) == FALSE) {
                 $success = FALSE;
             }
             fclose($this->filepointer);
             unlink($this->resource);
             break;
         case 'semaphore':
             if (@sem_release($this->resource)) {
                 sem_remove($this->resource);
             } else {
                 $success = FALSE;
             }
             break;
         case 'disable':
             $success = FALSE;
             break;
     }
     $this->isAcquired = FALSE;
     return $success;
 }
開發者ID:NaveedWebdeveloper,項目名稱:Test,代碼行數:38,代碼來源:class.t3lib_lock.php

示例10: destroy

 /**
  * Destroys the resource associated with the lock
  *
  * @return void
  */
 public function destroy()
 {
     if ($this->resource) {
         sem_remove($this->resource);
         @unlink($this->filePath);
     }
 }
開發者ID:dachcom-digital,項目名稱:TYPO3.CMS,代碼行數:12,代碼來源:SemaphoreLockStrategy.php

示例11: unlock

 public static function unlock($semId)
 {
     sem_release($semId);
     sem_remove($semId);
 }
開發者ID:kaka987,項目名稱:YoungYaf,代碼行數:5,代碼來源:ShareMemory.php

示例12: destroy

 /**
  * Force release
  */
 public function destroy()
 {
     sem_remove($this->__mutex);
     shm_remove($this->__shm);
 }
開發者ID:nejtr0n,項目名稱:shmestage,代碼行數:8,代碼來源:SharedMemory.php

示例13: __destruct

 public function __destruct()
 {
     foreach ($this->activeMegaListeners as $listener) {
         $this->megaApi->removeListener($listener);
     }
     foreach ($this->activeMegaRequestListeners as $listener) {
         $this->megaApi->removeRequestListener($listener);
     }
     foreach ($this->activeMegaTransferListeners as $listener) {
         $this->megaApi->removeTransferListener($listener);
     }
     foreach ($this->activeMegaGlobalListeners as $listener) {
         $this->megaApi->removeGlobalListener($listener);
     }
     sem_remove($this->semaphore);
 }
開發者ID:hhoareau,項目名稱:sdk,代碼行數:16,代碼來源:megaapi.php

示例14: release

 /**
  * Release the lock
  *
  * @return	boolean		Returns TRUE on success or FALSE on failure
  */
 public function release()
 {
     if (!$this->isAcquired) {
         return TRUE;
     }
     $success = TRUE;
     switch ($this->method) {
         case 'flock':
             if (flock($this->filepointer, LOCK_UN) == FALSE) {
                 $success = FALSE;
             }
             fclose($this->filepointer);
             //if (\TYPO3\CMS\Core\Utility\GeneralUtility::isAllowedAbsPath($this->resource) && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($this->resource, PATH_site . 'typo3temp'.DIRECTORY_SEPARATOR.'extbase_hijax'.DIRECTORY_SEPARATOR.'locks'.DIRECTORY_SEPARATOR)) {
             // TODO: add a scheduler task to remove old lock files
             // unlink($this->resource);
             //}
             break;
         case 'semaphore':
             if (@sem_release($this->resource)) {
                 sem_remove($this->resource);
             } else {
                 $success = FALSE;
             }
             break;
         case 'disable':
             $success = FALSE;
             break;
     }
     $this->isAcquired = FALSE;
     return $success;
 }
開發者ID:seitenarchitekt,項目名稱:extbase_hijax,代碼行數:36,代碼來源:Lock.php

示例15: __release

 /**
  * Release all resource after process end
  * Call by destruct
  * 
  * @return void
  */
 protected function __release()
 {
     // release global space for vars
     $this->global->remove();
     // release shared space for vars
     $this->shared->remove();
     // remove mutex for lock
     @sem_remove($this->mutex);
 }
開發者ID:liningwang,項目名稱:camera-beijing,代碼行數:15,代碼來源:Process.php


注:本文中的sem_remove函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。