pthreads 0.1.0 and Thread::kill(). Needs fix

This commit is contained in:
Shoghi Cervantes 2014-01-27 15:18:20 +01:00
parent b7cf5d08cc
commit ac8f2646a7
4 changed files with 15 additions and 5 deletions

View File

@ -47,6 +47,9 @@ class ConsoleAPI{
if(!defined("NO_THREADS")){ if(!defined("NO_THREADS")){
$this->loop->stop(); $this->loop->stop();
$this->loop->notify(); $this->loop->notify();
//@fclose($this->loop->fp);
usleep(50000);
$this->loop->kill();
//$this->loop->join(); //$this->loop->join();
} }
} }
@ -294,7 +297,7 @@ class ConsoleLoop extends Thread{
public $stop; public $stop;
public $base; public $base;
public $ev; public $ev;
public $fp; public $fp;
public function __construct(){ public function __construct(){
$this->line = false; $this->line = false;
$this->stop = false; $this->stop = false;
@ -319,7 +322,7 @@ class ConsoleLoop extends Thread{
public function run(){ public function run(){
if(!extension_loaded("readline")){ if(!extension_loaded("readline")){
$this->fp = fopen( "php://stdin", "r" ); $this->fp = fopen("php://stdin", "r");
} }
while($this->stop === false){ while($this->stop === false){
@ -328,7 +331,7 @@ class ConsoleLoop extends Thread{
$this->line = false; $this->line = false;
} }
if(!$this->haveReadline){ if(!extension_loaded("readline")){
@fclose($fp); @fclose($fp);
} }
exit(0); exit(0);

View File

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
COMPILER_VERSION="0.14" COMPILER_VERSION="0.15"
PHP_VERSION="5.5.8" PHP_VERSION="5.5.8"
ZEND_VM="GOTO" ZEND_VM="GOTO"
LIBEDIT_VERSION="0.3" LIBEDIT_VERSION="0.3"
ZLIB_VERSION="1.2.8" ZLIB_VERSION="1.2.8"
PTHREADS_VERSION="0.0.45" PTHREADS_VERSION="0.1.0"
CURL_VERSION="curl-7_34_0" CURL_VERSION="curl-7_34_0"
echo "[PocketMine] PHP installer and compiler for Linux & Mac" echo "[PocketMine] PHP installer and compiler for Linux & Mac"

View File

@ -54,6 +54,11 @@ if(!extension_loaded("sockets") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"")
if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "pthreads." . PHP_SHLIB_SUFFIX) === false){ if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "pthreads." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the pthreads extension.", true, true, 0); console("[ERROR] Unable to find the pthreads extension.", true, true, 0);
++$errors; ++$errors;
}else{
if(version_compare(phpversion("pthreads"), "0.1.0") < 0){
console("[ERROR] pthreads >= 0.1.0 is required.", true, true, 0);
++$errors;
}
} }
if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){ if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){

View File

@ -55,6 +55,8 @@ class RCON{
for($n = 0; $n < $this->threads; ++$n){ for($n = 0; $n < $this->threads; ++$n){
$this->workers[$n]->close(); $this->workers[$n]->close();
$this->workers[$n]->join(); $this->workers[$n]->join();
usleep(50000);
$this->workers[$n]->kill();
} }
@socket_close($this->socket); @socket_close($this->socket);
$this->threads = 0; $this->threads = 0;