From 11fbc8db6fe0dbf3cc0004954e7c1e988d83892f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Apr 2024 19:40:44 +0100 Subject: [PATCH] Make use of pmmpthread 6.1.0 for Thread::getRunningCount() ThreadManager doesn't count these correctly anymore since pmmpthread since thread-safe statics aren't copied anymore. --- composer.json | 2 +- composer.lock | 4 ++-- src/utils/Process.php | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 1ef7d1aa2..da6536ff6 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-openssl": "*", "ext-pcre": "*", "ext-phar": "*", - "ext-pmmpthread": "^6.0.7", + "ext-pmmpthread": "^6.1.0", "ext-reflection": "*", "ext-simplexml": "*", "ext-sockets": "*", diff --git a/composer.lock b/composer.lock index a3443229a..5e44bd686 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "28633153e56932cbd9e1dbcd7f7e6756", + "content-hash": "05f535c2b562b59c11b6ac535b5f1c99", "packages": [ { "name": "adhocore/json-comment", @@ -2953,7 +2953,7 @@ "ext-openssl": "*", "ext-pcre": "*", "ext-phar": "*", - "ext-pmmpthread": "^6.0.7", + "ext-pmmpthread": "^6.1.0", "ext-reflection": "*", "ext-simplexml": "*", "ext-sockets": "*", diff --git a/src/utils/Process.php b/src/utils/Process.php index c57b96d4a..2e9b46ace 100644 --- a/src/utils/Process.php +++ b/src/utils/Process.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace pocketmine\utils; +use pocketmine\thread\Thread; use pocketmine\thread\ThreadManager; use function count; use function exec; @@ -122,7 +123,7 @@ final class Process{ //TODO: more OS - return count(ThreadManager::getInstance()->getAll()) + 2; //MainLogger + Main Thread + return Thread::getRunningCount() + 1; //pmmpthread doesn't count the main thread } /**