Merge branch 'release/3.4'

This commit is contained in:
Dylan K. Taylor
2018-12-04 18:40:54 +00:00
5 changed files with 66 additions and 3 deletions

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pocketmine\scheduler;
use pocketmine\utils\Utils;
/**
* Manages general-purpose worker threads used for processing asynchronous tasks, and the tasks submitted to those
* workers.
@ -84,6 +86,7 @@ class AsyncPool{
* @param \Closure $hook
*/
public function addWorkerStartHook(\Closure $hook) : void{
Utils::validateCallableSignature(function(int $worker) : void{}, $hook);
$this->workerStartHooks[spl_object_hash($hook)] = $hook;
foreach($this->workers as $i => $worker){
$hook($i);

View File

@ -45,6 +45,7 @@ class ClosureTask extends Task{
* @param \Closure $closure Must accept only ONE parameter, $currentTick
*/
public function __construct(\Closure $closure){
Utils::validateCallableSignature(function(int $currentTick) : void{}, $closure);
$this->closure = $closure;
}