当前位置: 首页>>代码示例>>PHP>>正文


PHP shm_remove函数代码示例

本文整理汇总了PHP中shm_remove函数的典型用法代码示例。如果您正苦于以下问题:PHP shm_remove函数的具体用法?PHP shm_remove怎么用?PHP shm_remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了shm_remove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 public function tearDown()
 {
     shm_remove($this->shmResource);
     shm_detach($this->shmResource);
     @unlink($this->tmpFileName);
     unset($this->shmAdapter, $this->kvs);
 }
开发者ID:adammbalogh,项目名称:key-value-store-shared-memory,代码行数:7,代码来源:AbstractKvsSharedMemoryTestCase.php

示例2: flush

 /**
  * Flush entire cache.
  */
 function flush()
 {
     parent::flush();
     // remove and reconnect to the SHM block
     shm_remove($this->shmid);
     $this->shmid = shm_attach($this->shmkey, $this->memsize, 0600);
 }
开发者ID:jvinet,项目名称:pronto,代码行数:10,代码来源:shm.php

示例3: destroy

 public function destroy()
 {
     $nbProcess = $this->updateNbProcess(-1);
     if ($nbProcess < 1) {
         shm_remove($this->memory);
     } else {
         shm_detach($this->memory);
     }
 }
开发者ID:CrakLabs,项目名称:ipc-component,代码行数:9,代码来源:ShmMemory.php

示例4: 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

示例5: remove

 /**
  * remove shared memory.
  * you should know that it maybe does not work.
  *
  * @return bool
  */
 public function remove()
 {
     //dallocate shared memory
     if (!shm_remove($this->shm)) {
         return false;
     }
     $this->dettach();
     // shm_remove maybe not working. it likes a php bug.
     unset($this->shm);
     return true;
 }
开发者ID:jzxyouok,项目名称:simple-fork-php,代码行数:17,代码来源:SharedMemory.php

示例6: drop

 public function drop()
 {
     try {
         $shm = shm_attach($this->id, self::SEGMENT_SIZE, HESPER_IPC_PERMS);
     } catch (BaseException $e) {
         return false;
     }
     $result = shm_remove($shm);
     shm_detach($shm);
     return $result;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:SharedMemorySegmentHandler.php

示例7: 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

示例8: destroy

 public function destroy()
 {
     if (!is_null($this->shm_res) && is_resource($this->shm_res)) {
         shm_remove($this->shm_res);
         if (file_exists($this->tmp_file)) {
             unlink($this->tmp_file);
         }
         $this->shm_res = null;
         $this->logger->debug('Delete shared memory resource');
     }
 }
开发者ID:brutalsys,项目名称:rmq_worker,代码行数:11,代码来源:SHM.php

示例9: __destruct

 public function __destruct()
 {
     if ($this->changed) {
         if (shm_put_var($this->res, self::DEFAULT_VAR_ID, $this->data) === false) {
             $length = strlen($this->data);
             shm_remove($this->res);
             $this->res = shm_attach($this->id, ceil($length * 1.25));
             shm_put_var($this->res, self::DEFAULT_VAR_ID, $this->data);
         }
     }
     shm_detach($this->res);
 }
开发者ID:wapmorgan,项目名称:kvstorage,代码行数:12,代码来源:Shm.php

示例10: teardown

 public function teardown()
 {
     // Check shm validity before shm_get_var, return directly if NULL or FALSE
     // This may happen when check_environment fail.
     if ($this->shm) {
         $lock = shm_get_var($this->shm, self::ADDRESS);
     } else {
         return;
     }
     // If this PID set this lock, release it
     if ($lock['pid'] == $this->pid) {
         shm_remove($this->shm);
         shm_detach($this->shm);
     }
 }
开发者ID:adnanrahim,项目名称:PHP-Daemon,代码行数:15,代码来源:Shm.php

示例11: getBadAddressList

 /**
  * 获取故障节点列表
  * @return array
  */
 public static function getBadAddressList($use_cache = true)
 {
     // 没有加载扩展
     if (!extension_loaded('sysvshm')) {
         self::$badAddressList = array();
         return false;
     }
     // 还没有初始化故障节点
     if (null === self::$badAddressList || !$use_cache) {
         // 是否有故障节点
         if (!shm_has_var(self::getShmFd(), RPC_BAD_ADDRESS_KEY2)) {
             self::$badAddressList = array();
         } else {
             // 获取故障节点
             $bad_address_list = shm_get_var(self::getShmFd(), RPC_BAD_ADDRESS_KEY2);
             if (false === $bad_address_list || !is_array($bad_address_list)) {
                 // 出现错误,可能是共享内存写坏了,删除共享内存
                 $ret = shm_remove(self::getShmFd());
                 self::$badAddressShmFd = shm_attach(self::BAD_ASSRESS_LIST_SHM_KEY);
                 self::$badAddressList = array();
                 // 这个不要再加锁了
                 self::checkConfigMd5();
             } else {
                 self::$badAddressList = $bad_address_list;
             }
         }
     }
     return self::$badAddressList;
 }
开发者ID:nangong92t,项目名称:go_src,代码行数:33,代码来源:TestThriftClientWorker.php

示例12: getBadAddressList

 /**
  * 获取故障节点列表
  * @return array
  */
 public static function getBadAddressList($use_cache = true)
 {
     // 还没有初始化故障节点
     if (null === self::$badAddressList || !$use_cache) {
         $bad_address_list = array();
         if (self::$shmEnable && shm_has_var(self::getShmFd(), self::SHM_BAD_ADDRESS_KEY)) {
             // 获取故障节点
             $bad_address_list = shm_get_var(self::getShmFd(), self::SHM_BAD_ADDRESS_KEY);
             if (!is_array($bad_address_list)) {
                 // 可能是共享内寻写怀了,重新清空
                 self::getMutex();
                 shm_remove(self::getShmFd());
                 self::releaseMutex();
                 self::$badAddressShmFd = null;
                 self::$badAddressList = array();
             } else {
                 self::$badAddressList = $bad_address_list;
             }
         } else {
             self::$badAddressList = $bad_address_list;
         }
     }
     return self::$badAddressList;
 }
开发者ID:bennysuh,项目名称:myself-wokerman,代码行数:28,代码来源:AddressManager.php

示例13: remove

 public function remove()
 {
     shm_remove($this->shm_id);
     return TRUE;
 }
开发者ID:hwsyy,项目名称:php-backend-server,代码行数:5,代码来源:ShareMemory.class.php

示例14: destroy

 /**
  * Force release
  */
 public function destroy()
 {
     sem_remove($this->__mutex);
     shm_remove($this->__shm);
 }
开发者ID:nejtr0n,项目名称:shmestage,代码行数:8,代码来源:SharedMemory.php

示例15: Delete

 function Delete()
 {
     if (!function_exists("shm_attach")) {
         $this->ok = false;
         return;
     }
     shm_remove($this->shmid);
     shm_detach($this->shmid);
 }
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:9,代码来源:class.semaphores.php


注:本文中的shm_remove函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。