mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
RakLib: split PthreadsChannelWriter into two implementations
this gains a very small performance improvement by avoiding unnecessary !== null checks on every packet written in either direction. It's insignificant for sure, but I just found this code in an old stash, so what the heck.
This commit is contained in:
@ -23,18 +23,12 @@ use raklib\server\ipc\InterThreadChannelWriter;
|
||||
final class PthreadsChannelWriter implements InterThreadChannelWriter{
|
||||
/** @var \Threaded */
|
||||
private $buffer;
|
||||
/** @var SleeperNotifier|null */
|
||||
private $notifier;
|
||||
|
||||
public function __construct(\Threaded $buffer, ?SleeperNotifier $notifier = null){
|
||||
public function __construct(\Threaded $buffer){
|
||||
$this->buffer = $buffer;
|
||||
$this->notifier = $notifier;
|
||||
}
|
||||
|
||||
public function write(string $str) : void{
|
||||
$this->buffer[] = $str;
|
||||
if($this->notifier !== null){
|
||||
$this->notifier->wakeupSleeper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user