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


PHP msg_remove_queue函数代码示例

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


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

示例1: __destruct

 public function __destruct()
 {
     if ($this->ipcKey->isOwner(getmypid())) {
         $this->ipcKey->delete();
         return msg_remove_queue($this->id);
     }
 }
开发者ID:ackintosh,项目名称:snidel,代码行数:7,代码来源:AbstractQueue.php

示例2: __destruct

 public function __destruct()
 {
     if ($this->keyPrefix . getmypid() === $this->getKey()) {
         unlink('/tmp/' . sha1($this->getKey()));
         return msg_remove_queue($this->id);
     }
 }
开发者ID:TomoakiNagahara,项目名称:snidel,代码行数:7,代码来源:Token.php

示例3: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     if (!msg_remove_queue($this->getQueue())) {
         throw new QueueException($this, 'Failed to destroy the queue.');
     }
     $this->queue = null;
 }
开发者ID:rybakit,项目名称:phive-queue,代码行数:10,代码来源:SysVQueue.php

示例4: destroyAndWaitForChildren

 /**
  * Destroy every resource and wait for zombies.
  */
 protected function destroyAndWaitForChildren()
 {
     msg_remove_queue($this->getQueueManager());
     sem_remove($this->getLockManager());
     for ($i = 0; $i <= $this->childNumber; $i++) {
         pcntl_wait($status);
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:11,代码来源:rcParallelTask.class.php

示例5: close

 public function close()
 {
     $this->closed = true;
     do {
         $this->out();
         --$this->msg_count;
     } while ($this->msg_count >= 0);
     msg_remove_queue($this->ipc);
     file_exists($this->ipc_fn) && @unlink($this->ipc_fn);
 }
开发者ID:straiway,项目名称:fmt,代码行数:10,代码来源:csp.php

示例6: __construct

 public function __construct($message, $option = [])
 {
     $this->id = crc32($message);
     $this->perms = $option['perms'] ? $option['perms'] : 0666;
     if ($option['reset']) {
         $msg = msg_get_queue($this->id, $this->perms);
         $msg && msg_remove_queue($msg);
     }
     $this->msg = msg_get_queue($this->id, $this->perms);
 }
开发者ID:heesey,项目名称:epserver,代码行数:10,代码来源:SystemIPC.php

示例7: readAction

 public function readAction()
 {
     $msg_id = msg_get_queue($this->_key, 0600);
     while (true) {
         if (msg_receive($msg_id, 1, $msg_type, 16384, $msg, true, 0, $msg_error)) {
             list($id, $msg) = split('!', $msg);
             echo json_encode(array('id' => $id, 'msg' => $msg));
         }
     }
     msg_remove_queue($msg_id);
 }
开发者ID:jaredquinn,项目名称:phpTinyFW,代码行数:11,代码来源:Controller.php

示例8: start

 public function start()
 {
     set_time_limit(0);
     if (file_exists($this->file)) {
         unlink($this->file);
     }
     file_put_contents($this->file, '');
     $this->queue = msg_get_queue(ftok($this->file, 'R'), 0777);
     msg_set_queue($this->queue, []);
     msg_remove_queue($this->queue);
     $this->queue = msg_get_queue(ftok($this->file, 'R'), 0777);
     $this->listen();
 }
开发者ID:level-2,项目名称:aphplication,代码行数:13,代码来源:Aphplication.php

示例9: initQueue

 public static function initQueue($queue_file)
 {
     if (!file_exists($queue_file)) {
         touch($queue_file);
     }
     $msg_id = msg_get_queue(ftok($queue_file, 'r'), 0666);
     // Remove any messages in queue
     $queue = msg_stat_queue($msg_id);
     if ($queue['msg_qnum'] > 0) {
         msg_remove_queue($msg_id);
         $msg_id = msg_get_queue(ftok($queue_file, 'r'), 0666);
     }
     return $msg_id;
 }
开发者ID:blamh,项目名称:ipc_mailbox,代码行数:14,代码来源:Receiver.php

示例10: drop

 public function drop()
 {
     try {
         $q = msg_get_queue($this->id, ONPHP_IPC_PERMS);
     } catch (BaseException $e) {
         // removed in race
         return true;
     }
     if (!msg_remove_queue($q)) {
         // trying to flush manually
         $type = $msg = null;
         while (msg_receive($q, 0, $type, 2, $msg, false, MSG_IPC_NOWAIT)) {
             // do nothing
         }
     }
     return true;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:17,代码来源:MessageSegmentHandler.class.php

示例11: __destruct

 /**
  * The class destructor.
  */
 public function __destruct()
 {
     parent::__destruct();
     if ($this->iAmParent()) {
         $desiredType = 1;
         $option_receive = MSG_IPC_NOWAIT;
         $stats = msg_stat_queue($this->queueResourceResponse);
         $queueMessageSize = $stats['msg_qbytes'];
         // the Report
         $messageReport = '';
         // receive the report
         $stats = msg_stat_queue($this->queueResourceResponse);
         while ($stats['msg_qnum']) {
             //for($i=0;count($all_servers);$i++){
             $status = msg_receive($this->queueResourceResponse, $desiredType, $type, $queueMessageSize, $mixed, true, $option_receive);
             if ($status == true) {
                 $messageReport .= $mixed['message'];
                 if ($mixed['return'] < 0) {
                     // check if server counldn't do the backups because shutdown doesn't work
                     if ($mixed['error'] && $mixed['error']['error']['error'] == '_ERR_VM_BACKUP_STILL_RUNNING_') {
                         $etva_server = $mixed['server'];
                         $this->log("[WARN] Receive error that VM '" . $etva_server->getName() . "' couldn't make backup beacuse is still running, so i will try start again...");
                         $etva_node = $etva_server->getEtvaNode();
                         if ($etva_node) {
                             $res_start = $etva_node->soapSend(EtvaServer_VA::SERVER_START, array('uuid' => $etva_server->getUuid(), 'name' => $etva_server->getName()));
                             $this->log("[WARN] Start '" . $etva_server->getName() . "' VM and receive the following message: " . print_r($res_start, true));
                         }
                     }
                 }
             } else {
                 $err_m = "[ERROR] Receive error when wait for response... " . print_r($err, true);
                 $messageReport .= $err_m . "\r\n";
                 $this->log($err_m);
             }
             $stats = msg_stat_queue($this->queueResourceResponse);
         }
         msg_remove_queue($this->queueResourceResponse);
         //$this->log($messageReport);
         $this->sendReport($messageReport);
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:44,代码来源:nodeBackupserversTask.class.php

示例12: array

<?php

$tests = array(null, 'foo');
foreach ($tests as $q) {
    if ($q === null) {
        do {
            $id = ftok(__FILE__, chr(mt_rand(0, 255)));
        } while (msg_queue_exists($id));
        $q = msg_get_queue($id) or die("Failed to create queue");
        msg_remove_queue($q) or die("Failed to close queue");
    }
    echo "Using '{$q}' as queue resource:\n";
    $errno = 0;
    var_dump(msg_set_queue($q, array('msg_qbytes' => 1)));
    var_dump(msg_stat_queue($q));
    var_dump(msg_receive($q, 0, $null, 1, $msg, true, 0, $errno));
    var_dump($errno != 0);
    // again, but triggering an E_WARNING
    var_dump(msg_receive($q, 0, $null, 0, $msg));
    var_dump(msg_send($q, 1, 'foo', true, true, $errno));
    var_dump($errno != 0);
}
echo "Done\n";
开发者ID:gleamingthecube,项目名称:php,代码行数:23,代码来源:ext_sysvmsg_tests_005.php

示例13: delete

 /**
  * Delete message from queue
  *
  * @param int $pid
  * @param callable $callback function handler
  * @return boolean
  */
 public function delete($pid = null, callable $callback = null)
 {
     $this->queuePid = is_null($pid) === false ? $pid : $this->queuePid;
     if (msg_queue_exists($this->queuePid) === true) {
         msg_remove_queue(msg_get_queue($this->queuePid));
         return true;
     }
     return false;
 }
开发者ID:stanislav-web,项目名称:express-mailer,代码行数:16,代码来源:Native.php

示例14: __destruct

 public function __destruct()
 {
     // Shut down and remove the queue
     $success = msg_remove_queue($this->message_queue_resource);
     assert($success, "Failed to remove queue with ID {$this->message_queue_resource}");
 }
开发者ID:nagyistge,项目名称:phan,代码行数:6,代码来源:ParallelParentCollector.php

示例15: free

    /**
     * Removes the semaphore if it still exists.
     *
     * @throws SemaphoreException If the operation failed.
     */
    public function free()
    {
        if (is_resource($this->queue) && msg_queue_exists($this->key)) {
            if (!msg_remove_queue($this->queue)) {
                throw new SemaphoreException('Failed to free the semaphore.');
            }

            $this->queue = null;
        }
    }
开发者ID:Nik-ADA,项目名称:concurrent,代码行数:15,代码来源:PosixSemaphore.php


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