[concurrency-interest] Re : takeOrWake() method for a LinkedBlockingQueue
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...
More information about the Concurrency-interest