45 protected bool $ready =
false;
46 protected string $mainPath;
56 protected ThreadSafeArray $mainToThreadBuffer,
57 protected ThreadSafeArray $threadToMainBuffer,
59 protected int $serverId,
60 protected int $maxMtuSize,
61 protected int $protocolVersion,
64 $this->mainPath = \pocketmine\PATH;
68 public function startAndWait(
int $options = NativeThread::INHERIT_NONE) : void{
69 $this->start($options);
70 $this->
synchronized(
function() :
void{
71 while(!$this->ready && $this->getCrashInfo() ===
null){
74 $crashInfo = $this->getCrashInfo();
75 if($crashInfo !==
null){
76 if($crashInfo->getType() === SocketException::class){
77 throw new SocketException($crashInfo->getMessage());
84 protected function onRun() : void{
86 ini_set(
"display_errors",
'1');
87 ini_set(
"display_startup_errors",
'1');
88 \GlobalLogger::set($this->logger);
90 $socket =
new ServerSocket($this->address->deserialize());
91 $manager =
new Server(
96 new SimpleProtocolAcceptor($this->protocolVersion),
97 new UserToRakLibThreadMessageReceiver(
new PthreadsChannelReader($this->mainToThreadBuffer)),
98 new RakLibToUserThreadMessageSender(
new SnoozeAwarePthreadsChannelWriter($this->threadToMainBuffer, $this->sleeperEntry->createNotifier())),
99 new ExceptionTraceCleaner($this->mainPath),
100 recvMaxSplitParts: 512
102 $this->
synchronized(
function() :
void{
106 while(!$this->isKilled){
107 $manager->tickProcessor();
109 $manager->waitShutdown();
112 public function getThreadName() : string{
__construct(protected ThreadSafeLogger $logger, protected ThreadSafeArray $mainToThreadBuffer, protected ThreadSafeArray $threadToMainBuffer, InternetAddress $address, protected int $serverId, protected int $maxMtuSize, protected int $protocolVersion, protected SleeperHandlerEntry $sleeperEntry)