當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。