http://www.perlmonks.org?node_id=1056355


in reply to Re^6: How can I force thread switching?
in thread How can I force thread switching?

The reason why I use my own thread ids is I want to be 100% sure they lie in 1..number_of_threads range (0 is used for scrolling messages).

Understood, but since you are only using 4 threads, and tids are monotonically increasing; there is no problem. But, your call.

Your Q implementation is exactly what I need. Since i'm not the only one to need this feature, I wonder why this is not included in the queue package.

I wrote it for my purposes. In part to add the self-limiting aspect, in part to discard what I consider to be broken functionality that was added to Thread::Queue (all the peek & random access nonsense has no place in a queue implementation).

I posted it here because someone else had the same need. I've never got around to publishing it because the aggravation of doing so is more than I need.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.