本文整理汇总了PHP中msg_get_queue函数的典型用法代码示例。如果您正苦于以下问题:PHP msg_get_queue函数的具体用法?PHP msg_get_queue怎么用?PHP msg_get_queue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了msg_get_queue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->ipc_fn = tempnam(sys_get_temp_dir(), 'csp.' . uniqid('chn', true));
$this->key = ftok($this->ipc_fn, 'A');
$this->ipc = msg_get_queue($this->key, 0666);
msg_set_queue($this->ipc, $cfg = ['msg_qbytes' => 1 * PHP_INT_LENGTH]);
}
示例2: __construct
/**
* Init Tunnel.
*/
public function __construct()
{
$this->parentPID = getmypid();
$this->bridge = $this->createBridge();
$this->queue = msg_get_queue(ftok(__FILE__, 'k'));
pcntl_signal(POLL_MSG, [$this, 'read']);
}
示例3: shutdown
public function shutdown()
{
$this->queue = msg_get_queue(ftok($this->file, 'R'), 0777);
for ($i = 0; $i < $this->numThreads * 2; $i++) {
msg_send($this->queue, 100 + $i, 'shutdown');
}
}
示例4: actionDequeue
public function actionDequeue($qId, $data)
{
$q = msg_get_queue($qId);
$r = msg_receive($q, 1, $msgType, 10000, $msg);
echo "Result: " . $r . "<br/>";
echo " Got msg: " . $msg;
}
示例5: getInstance
public static function getInstance()
{
if (!self::$_queue) {
self::$_queue = msg_get_queue(self::LC_MSG_KEY);
}
return self::$_queue;
}
示例6: __construct
public function __construct($id, $info)
{
$this->id = $id;
$this->info = $info;
$this->msgSemKey = sem_get(9876543210);
$this->queKey = msg_get_queue(123456788);
}
示例7: __construct
public function __construct(Config $config)
{
$this->ownerPid = $config->get('ownerPid');
$this->ipcKey = new IpcKey($this->ownerPid, str_replace('\\', '_', get_class($this)));
$this->id = msg_get_queue($this->ipcKey->generate());
$this->stat = msg_stat_queue($this->id);
}
示例8: getQueue
private function getQueue()
{
if ($this->_queue === null) {
$this->_queue = msg_get_queue($this->getKey(), $this->permissions);
}
return $this->_queue;
}
示例9: initQueue
protected function initQueue()
{
if (null !== $this->msgHandle) {
return;
}
$this->msgHandle = msg_get_queue($this->getId());
}
示例10: initialize
public function initialize()
{
if ($this->queuePath) {
return;
}
$this->queuePath = KATATMP . 'queue' . DS;
if (defined('QUEUE_IDENTIFIER')) {
$this->queueId = QUEUE_IDENTIFIER;
} else {
if (defined('CACHE_IDENTIFIER')) {
$this->queueId = (int) hexdec(md5(CACHE_IDENTIFIER));
} else {
$this->queueId = ftok(__FILE__);
}
}
switch ($this->method) {
case null:
throw new Exception('You have to setMethod() first');
break;
case self::QM_MSGQUEUE:
$this->queueRes = msg_get_queue($this->queueId, 0666);
break;
case self::QM_ZEROMQ:
break;
case self::QM_LIBEVENT:
break;
case self::QM_FILESOCKET:
break;
case self::QM_FILESYS:
break;
}
//switch
}
示例11: setKey
public function setKey($key)
{
if ($this->key !== $key) {
$this->key = $key;
$this->queue = msg_get_queue($this->key);
}
}
示例12: __construct
public function __construct($queue_file)
{
if (!file_exists($queue_file)) {
throw new Exception("Could not find mailbox: {$queue_file}");
}
$this->queue_id = msg_get_queue(ftok($queue_file, 'r'), 0666);
}
示例13: __construct
/**
* Create a ParallelChildCollector that will collect
* issues as normal, but emit them to a message queue
* for collection by a
* \Phan\Output\Collector\ParallelParentCollector.
*/
public function __construct()
{
assert(extension_loaded('sysvsem'), 'PHP must be compiled with --enable-sysvsem in order to use -j(>=2).');
assert(extension_loaded('sysvmsg'), 'PHP must be compiled with --enable-sysvmsg in order to use -j(>=2).');
// Create a message queue for this process group
$message_queue_key = posix_getpgid(posix_getpid());
$this->message_queue_resource = msg_get_queue($message_queue_key);
}
示例14: getQueue
protected function getQueue($queueName)
{
if (!isset($this->semaphore[$queueName])) {
$id = crc32($queueName);
$this->semaphore[$queueName] = msg_get_queue($id);
}
return $this->semaphore[$queueName];
}
示例15: initQueue
/**
* init queue
*
* @param $ipc_filename
* @param $msg_type
* @throws \Exception
*/
protected function initQueue($ipc_filename, $msg_type)
{
$this->key_t = $this->getIpcKey($ipc_filename, $msg_type);
$this->queue = \msg_get_queue($this->key_t);
if (!$this->queue) {
throw new \RuntimeException('msg_get_queue failed');
}
}