Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker::isRunning() returns false after its run() method exits, even if it's running tasks #60

Open
dktapps opened this issue May 21, 2021 · 0 comments

Comments

@dktapps
Copy link
Member

dktapps commented May 21, 2021

An interesting bug recently surfaced in PM: pmmp/PocketMine-MP@61077c4

In my opinion, a worker should always be considered "running" as long as it hasn't shut down, because internally what's essentially happening is this:

while(!$this->shutdown && $this->queue->count() > 0){
    $task = $this->queue->synchronized(function() : void{
        while($this->queue->count() === 0){
            $this->queue->wait();
        }
        return $this->queue->shift();
    });
    $task->run();
}

If a Worker was implemented in userland, this wouldn't be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant