[concurrency-interest] Blocking queue
gykwok at yahoo.com
Wed May 17 21:44:48 EDT 2006
Presumably, the takeType2BeforeType1Task() method
waits for anyQueueNotEmpty. But the one who signals
it is the put(type2obj). So, the
takeType2BeforeType1Task() method would really only be
the takeType2Task() method if I understand correctly.
On 5/17/06, Dawid Kurzyniec <dawidk at mathcs.emory.edu>
I'd implement it by writing a custom blocking
queue implementation (not
necessarily implementing the BlockingQueue
interface) using two
non-blocking queues internally and providing its
mechanisms on top of that, using condition
variables. For instance,
type2queueNotFull might be your conditions; the
await on type2queueNotFull, then put, then signal
"takeType1task()" would wait on
type1queueNotEmpty, then take, then
signal type1queueNotFull, etc.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Concurrency-interest