1. class PoolId {
  2. public static function get($id = null) {
  3. if ($id === null) {
  4. $id = \Swoole\Coroutine::getCid();
  5. }
  6. $pid = \Swoole\Coroutine::getPcid($id);
  7. if ($pid < 0) {
  8. return $id;
  9. }
  10. return self::get($pid);
  11. }
  12. }