[concurrency-interest] Re : takeOrWake() method for a LinkedBlockingQueue

Jeff Hain jeffhain at rocketmail.com
Sun Nov 7 20:19:29 EST 2010

Thanks, I didn't (want to) think of interrupt as a way to stop the wait
(looked too brutal to me, but indeed it has its use cases!).



De : Martin Buchholz <martinrb at google.com>
À : Jeff Hain <jeffhain at rocketmail.com>
Cc : concurrency-interest at cs.oswego.edu
Envoyé le : Dim 7 novembre 2010, 23h 58min 12s
Objet : Re: [concurrency-interest] takeOrWake() method for a LinkedBlockingQueue

Writing a thread pool is non-trivial.

ThreadPoolExecutor tackles some of the same sort of issues, e.g. need
to notify waiting threads on shutdown.

The most obvious thing to do is to interrupt waiting threads, have
them catch InterruptedException, and then reexamine the state of the
executor.  See TPE.interruptIdleWorkers for inspiration.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20101108/b4979483/attachment.html>

More information about the Concurrency-interest mailing list