The only explanation that I've found so far is here: http://pthreads.org
But what does that mean in terms of code? When should I use Worker(s) and where should I use Threads?
Thanks!
They are both Threads, but, a Thread is intended to execute one task ( that defined in it's run method ) and then exit. A Worker is intended to wait for tasks, in the form of Stackable derived objects, implementing their own run methods and execute them from a stack in the order they are inserted.
In this way, the Worker allows you to reuse a context, they provide a means of efficiency quite difficult to program in userland, but nothing like impossible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With