Thread::getCurrentThreadId PHP Method

getCurrentThreadId() public static method

Will return the identity of the currently executing thread
public static getCurrentThreadId ( ) : integer
return integer
    public static function getCurrentThreadId()
    {
    }

Usage Example

Beispiel #1
0
 public function handle(\Thread $thread)
 {
     $thread->start();
     echo "Start thread with ID {$thread->getCurrentThreadId()}\n";
     return Observable::create(function (ObserverInterface $observer) use($thread) {
         while ($thread->isRunning()) {
             $this->loop->tick();
         }
         try {
             echo "Thread finished\n";
             $thread->join();
             $observer->onNext(new Event('/thread/ok', $thread));
             $observer->onCompleted();
         } catch (\Exception $e) {
             echo "Thread error\n";
             $observer->onError($e);
         }
         unset($thread);
     });
 }
All Usage Examples Of Thread::getCurrentThreadId