pmmp / ext-pmmpthread

Fork of https://github.com/krakjoe/pthreads with a revamped API and PHP 8.1+ support
Other
81 stars 17 forks source link

A way to wait for a worker to complete tasks (without join/shutdown) #120

Closed dktapps closed 11 months ago

dktapps commented 1 year ago

This use-case has come up a bunch of times in the worker tests, and I'm also finding a need for it in unit-tests elsewhere.

We can't use getStacked() to wait, because getStacked() doesn't include the currently-running task. (Perhaps it should?)

dktapps commented 11 months ago

Fixed by 5efe94154c566887e54edd296b2e49184bcbe06b (permits using collect() as a precondition for wait()).