What is the difference between a Thread object and a Worker object (php pthreads)

The only explanation I have found so far is here: http://pthreads.org

But what does this mean in terms of code? When should you use Worker (s) and where to use Threads?

Thanks!

+4
source share
1 answer

Both of them are Threads, but Thread is designed to perform one task (defined in it by the start method) and then exit. The employee is designed to wait for tasks in the form of Stackable derived objects, implement their own launch methods and execute them from the stack in the order in which they were inserted.

Thus, the Worker allows you to reuse the context, they provide a means of efficiency, it is rather difficult to program in the user space, but nothing like this is possible.

+9
source

All Articles