How it works...

All 10 workers are instructed to post a message after their given timeout but, as you can see, only a single worker actually posts a message back to the main thread. This is because, after this first worker posts, we call terminate on all of the workers. This means that they will stop immediately, and unless another worker has already posted, it never will. So, we will almost always see a single message posted. It is possible that one or two other workers will post before being terminated.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.159.164