mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
how did this cause sigsegv on nper </3
This commit is contained in:
parent
c408b622eb
commit
f572605472
2 changed files with 8 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class ConsoleAPI{
|
||||
private static $loop; //why no Thread::kill in pthreads3
|
||||
private $loop; //why no Thread::kill in pthreads3. Making it static causes crashes of other threads on some servers(hi nper)
|
||||
private $server, $event, $help, $cmds, $alias;
|
||||
public $last;
|
||||
function __construct(){
|
||||
|
|
@ -15,7 +15,7 @@ class ConsoleAPI{
|
|||
public function init(){
|
||||
$this->server->schedule(2, [$this, "handle"], [], true);
|
||||
if(!defined("NO_THREADS")){
|
||||
self::$loop = new ConsoleLoop();
|
||||
$this->loop = new ConsoleLoop();
|
||||
}
|
||||
$this->register("help", "[page|command name]", [$this, "defaultCommands"]);
|
||||
$this->register("status", "", [$this, "defaultCommands"]);
|
||||
|
|
@ -51,8 +51,8 @@ class ConsoleAPI{
|
|||
function __destruct(){
|
||||
$this->server->deleteEvent($this->event);
|
||||
if(!defined("NO_THREADS")){
|
||||
self::$loop->stop();
|
||||
self::$loop->notify();
|
||||
$this->loop->stop();
|
||||
$this->loop->notify();
|
||||
usleep(50000);
|
||||
}
|
||||
}
|
||||
|
|
@ -66,10 +66,10 @@ class ConsoleAPI{
|
|||
if(defined("NO_THREADS")){
|
||||
return;
|
||||
}
|
||||
$line = self::$loop->line;
|
||||
$line = $this->loop->line;
|
||||
if($line !== false){
|
||||
$line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($line));
|
||||
self::$loop->line = false;
|
||||
$this->loop->line = false;
|
||||
$output = $this->run($line, "console");
|
||||
if($output != ""){
|
||||
$mes = explode("\n", trim($output));
|
||||
|
|
@ -78,7 +78,7 @@ class ConsoleAPI{
|
|||
}
|
||||
}
|
||||
}else{
|
||||
self::$loop->notify();
|
||||
$this->loop->notify();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ class ConsoleAPI{
|
|||
}
|
||||
return "TPS: {$info["tps"]}, Memory usage: {$info["memory_usage"]} (Peak {$info["memory_peak_usage"]})";
|
||||
case "stop":
|
||||
self::$loop->stop = true;
|
||||
$this->loop->stop = true;
|
||||
$this->server->close();
|
||||
return "Stopping the server\n";
|
||||
case "difficulty":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue