« Return to Thread: Phasers (were: TaskBarriers)

Re: Phasers (were: TaskBarriers)

by Doug Lea :: Rate this Message:

Reply to Author | View in Thread

Alex Miller wrote:

 > This is great to see!  I could definitely have used a Phaser now and again. I
 > blogged this note btw:
 >
 > http://tech.puredanger.com/2008/07/08/java7-phasers/
 >

Great; we'd welcome any nice punchy cut-n-paste-n-hack-able
examples you might have for the sample usage section.

 > One thing I mentioned there is that the necessity of subclassing a Phaser to
implement a barrier action smells to me.  Why not use an external Runnable/Task
action ala CyclicBarrier instead?
 >

Because onAdvance returns termination indicator, we'd want
a callback with three arguments (phaser, phase, parties)
so callee knows which phaser and what its state is (which
is a momentary state that will change upon return from
onAdvance). It seems a little easier all around to instead
have people do this by subclassing. Not too different in
intent than subclassing ThreadLocal for sake of initialValue.
But alternative suggestions would be welcome.

-Doug

_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://cs.oswego.edu/mailman/listinfo/concurrency-interest


 « Return to Thread: Phasers (were: TaskBarriers)

LightInTheBox - Buy quality products at wholesale price!