note 118129 added to thread.join

From: Date: Sat, 10 Oct 2015 02:37:31 +0000
Subject: note 118129 added to thread.join
Groups: php.notes 
Request: Send a blank email to php-notes+get-203930@lists.php.net to get a copy of this message
/** * 实现多线程的类 */ class synchronized extends Thread { public function run() { $daemon = new SendNoticeAction(); $daemon->main(); } } for ($i = 0; $i < 10; $i++) { $pool[] = new synchronized(); } foreach ($pool as $work) { //在独立线程中执行 run 方法 $work->start(); while ($work->isRunning()) { usleep(10); } //让当前执行上下文等待被引用线程执行完毕 $work->join(); } ---- Server IP: 72.52.91.14 Probable Submitter: 27.17.50.54 ---- Manual Page -- http://php.net/manual/en/thread.join.php Edit -- https://master.php.net/note/edit/118129 Del: integrated -- https://master.php.net/note/delete/118129/integrated Del: useless -- https://master.php.net/note/delete/118129/useless Del: bad code -- https://master.php.net/note/delete/118129/bad+code Del: spam -- https://master.php.net/note/delete/118129/spam Del: non-english -- https://master.php.net/note/delete/118129/non-english Del: in docs -- https://master.php.net/note/delete/118129/in+docs Del: other reasons-- https://master.php.net/note/delete/118129 Reject -- https://master.php.net/note/reject/118129 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203930) next »