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


PHP Process::getInternalId方法代码示例

本文整理汇总了PHP中Process::getInternalId方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::getInternalId方法的具体用法?PHP Process::getInternalId怎么用?PHP Process::getInternalId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Process的用法示例。


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

示例1: fork

 public function fork(Process $children, $user_name = null, $group_name = null)
 {
     if ($this->allocateSHMPerChildren()) {
         $children->setSHMSegment(new SHMCache(uniqid('process_manager;shm_per_children' . $children->getInternalId()), $this->allocateSHMPerChildren));
     }
     pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD));
     $pid = pcntl_fork();
     // Error
     if ($pid == -1) {
         throw new RuntimeException('pcntl_fork() returned -1, are you sure you are running the script from CLI?');
     } else {
         if (!$pid) {
             if (!is_null($group_name)) {
                 if (!$this->setGroup($group_name)) {
                     throw new RuntimeException('set group_name failed. are you sure you have the privileges?');
                 }
             }
             if (!is_null($user_name)) {
                 if (!$this->setUser($user_name)) {
                     throw new RuntimeException('set user_name failed. are you sure you have the privileges?');
                 }
             }
             $children->run();
             exit;
             // redundant, added only for clarity
         } else {
             $children->setStarted(true);
             $this->children[] = $children;
             // Store the children's PID
             $children->setPid($pid);
             pcntl_sigprocmask(SIG_UNBLOCK, array(SIGCHLD));
         }
     }
 }
开发者ID:jiangtong1125,项目名称:Zebra-Multi-Process,代码行数:34,代码来源:ProcessManager.php

示例2: fork

 public function fork(Process $children)
 {
     if ($this->allocateSHMPerChildren()) {
         $children->setSHMSegment(new \Zebra\Ipcs\SHMCache(\uniqid('process_manager;shm_per_children' . $children->getInternalId()), $this->allocateSHMPerChildren));
     }
     \pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD));
     $pid = \pcntl_fork();
     // Error
     if ($pid == -1) {
         throw new RuntimeException('pcntl_fork() returned -1, are you sure you are running the script from CLI?');
     } else {
         if (!$pid) {
             $children->run();
             exit;
             // redundant, added only for clarity
         } else {
             $children->setStarted(true);
             $this->children[] = $children;
             // Store the children's PID
             $children->setPid($pid);
             \pcntl_sigprocmask(SIG_UNBLOCK, array(SIGCHLD));
         }
     }
 }
开发者ID:gzweb,项目名称:Zebra-PHP-Framework,代码行数:24,代码来源:ProcessManager.class.php


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