mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
NO_THREADS mode for tests
This commit is contained in:
parent
a07ae731e3
commit
f9c405d46a
3 changed files with 13 additions and 5 deletions
|
|
@ -31,7 +31,9 @@ class ConsoleAPI{
|
|||
|
||||
public function init(){
|
||||
$this->server->schedule(2, array($this, "handle"), array(), true);
|
||||
$this->loop = new ConsoleLoop();
|
||||
if(!defined("NO_THREADS")){
|
||||
$this->loop = new ConsoleLoop();
|
||||
}
|
||||
$this->register("help", "[page|command name]", array($this, "defaultCommands"));
|
||||
$this->register("status", "", array($this, "defaultCommands"));
|
||||
$this->register("difficulty", "<0|1|2|3>", array($this, "defaultCommands"));
|
||||
|
|
@ -42,9 +44,11 @@ class ConsoleAPI{
|
|||
|
||||
function __destruct(){
|
||||
$this->server->deleteEvent($this->event);
|
||||
$this->loop->stop();
|
||||
$this->loop->notify();
|
||||
//$this->loop->join();
|
||||
if(!defined("NO_THREADS")){
|
||||
$this->loop->stop();
|
||||
$this->loop->notify();
|
||||
//$this->loop->join();
|
||||
}
|
||||
}
|
||||
|
||||
public function defaultCommands($cmd, $params, $issuer, $alias){
|
||||
|
|
@ -248,6 +252,9 @@ class ConsoleAPI{
|
|||
}
|
||||
|
||||
public function handle($time){
|
||||
if(defined("NO_THREADS")){
|
||||
return;
|
||||
}
|
||||
if($this->loop->line !== false){
|
||||
$line = trim($this->loop->line);
|
||||
$this->loop->line = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue