$bot->log("Black forum {$thread_name}/{$thread_id}: create post error!"); $bot->debug($post[$_post_id]); $error = 3; } } } } else { $error = 4; $bot->log("Black forum {$thread_name}: error!"); $redis->DEL("{$black_key}:{$alliance_key}:forum:{$continent_key}:id"); } } } exit($error); }; $thread->start($thread, $bot, $c_continents, $forum_id); $bot->debug("Started " . $thread->getName() . " with PID " . $thread->getPid() . "..."); array_push($executeThread, $thread); } foreach ($executeThread as $thread) { pcntl_waitpid($thread->getPid(), $status, WUNTRACED); $bot->debug("Stopped " . $thread->getPid() . '@' . $thread->getName() . (!pcntl_wifexited($status) ? ' with' : ' without') . " errors!"); if (pcntl_wifsignaled($status)) { $bot->log($thread->getPid() . '@' . $thread->getName() . " stopped with state #" . pcntl_wexitstatus($status) . " errors!"); } } $bot->log("Fork: closing, all childs done!"); unset($executeThread); $redis->reInstance(); } else { $bot->log("Black error: no forum '" . BOT_BLACK_FORUM . "'");
<?php include_once 'thread/Thread.php'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <?php for ($index = 1; $index < 5; $index++) { $a = time(); echo "<br>----->thread:{$index} time: {$a}"; $thread = new executeThread("hilo numero -> " . $index); $thread->start(); //$thread->run(); echo "<br> <-----------thread:{$index} diff" . time() - $a; } for ($i = 1; $i < 5; $i++) { echo $i . "\n"; } ?> </body> </html>