当前位置: 首页>>代码示例>>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;未经允许,请勿转载。