|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Resetable CountDownLatchHi!
I'm looking for something like a resetable CountDownLatch. Here's what I want to do: n thread render an image in parallel (each calling countDown() when done) and when all threads are finished, some logic (i.e. drawing to screen) needs to be executed. And then start all over again. I didn't find anything that fits in j.u.c. :-\ thx _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: Resetable CountDownLatchHi,
> I'm looking for something like a resetable CountDownLatch. Here's > what I want to do: n thread render an image in parallel (each > calling countDown() when done) and when all threads are finished, > some logic (i.e. drawing to screen) needs to be executed. And > then start all over again. You could just create a new CountDownLatch on each iteration. Alternatively if you don't care about blocking the rendering threads across iterations use a CyclicBarrier - the barrier action then makes it easy to do the logic on completion. David Holmes _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: Resetable CountDownLatchHi Timo,
you should take a look at the Phaser class. cheers Armin Timo Nentwig schrieb: > Hi! > > I'm looking for something like a resetable CountDownLatch. Here's what I want > to do: n thread render an image in parallel (each calling countDown() when > done) and when all threads are finished, some logic (i.e. drawing to screen) > needs to be executed. And then start all over again. > > I didn't find anything that fits in j.u.c. :-\ > > thx > _______________________________________________ > Concurrency-interest mailing list > Concurrency-interest@... > http://cs.oswego.edu/mailman/listinfo/concurrency-interest > _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: Resetable CountDownLatchArmin Hopp wrote > > you should take a look at the Phaser class. Yes - good point! But as this is a new class for JDK7 it might not be applicable yet. David Holmes > cheers > Armin > > Timo Nentwig schrieb: > > Hi! > > > > I'm looking for something like a resetable CountDownLatch. > Here's what I want > > to do: n thread render an image in parallel (each calling > countDown() when > > done) and when all threads are finished, some logic (i.e. > drawing to screen) > > needs to be executed. And then start all over again. > > > > I didn't find anything that fits in j.u.c. :-\ > > > > thx > > _______________________________________________ > > Concurrency-interest mailing list > > Concurrency-interest@... > > http://cs.oswego.edu/mailman/listinfo/concurrency-interest > > > > _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: Resetable CountDownLatchOn Sat, Oct 10, 2009 at 14:57, David Holmes <davidcholmes@...> wrote:
> > Armin Hopp wrote >> >> you should take a look at the Phaser class. > > Yes - good point! But as this is a new class for JDK7 it might not be > applicable yet. Our intent is to support the version of Phaser in the jsr166y package for the forseeable future, to be usable as a third-party add-on to jdk6. Martin _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: Resetable CountDownLatchForgive me if I am wrong, but might a better way to model this be
using the forkJoin framework? The basic idea being that you submit a render action to a fork join executor that will devolve into the recurse actions that render each image part and when they all become available, draws the image or makes it available to the draw queue. cheers, jed. On 10/10/2009, at 9:13 PM, Timo Nentwig <concurrency- interest@...> wrote: > Hi! > > I'm looking for something like a resetable CountDownLatch. Here's > what I want > to do: n thread render an image in parallel (each calling countDown > () when > done) and when all threads are finished, some logic (i.e. drawing to > screen) > needs to be executed. And then start all over again. > > I didn't find anything that fits in j.u.c. :-\ > > thx > _______________________________________________ > Concurrency-interest mailing list > Concurrency-interest@... > http://cs.oswego.edu/mailman/listinfo/concurrency-interest Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: Resetable CountDownLatchHi Jed, Timo
I agree with you. I implemented a grayscaler using FJ once, though with something fast like a grayscaler you might not get a speedup with small to normal sized images. Also you have to work double buffered if you need surrounding pixel to calculate the new pixel color. On large images you probably only want to double buffer border pixels which blows up the straight-forwardness of the implementation. But all in all I would still try to fit it into an RecursiveAction. As far as Timos explanations let as understand his problem, I say it practically begs for a FJ implementation. cheers Armin Jed Wesley-Smith schrieb: > Forgive me if I am wrong, but might a better way to model this be > using the forkJoin framework? The basic idea being that you submit a > render action to a fork join executor that will devolve into the > recurse actions that render each image part and when they all become > available, draws the image or makes it available to the draw queue. > > cheers, > jed. > > On 10/10/2009, at 9:13 PM, Timo Nentwig > <concurrency-interest@...> wrote: > >> Hi! >> >> I'm looking for something like a resetable CountDownLatch. Here's >> what I want >> to do: n thread render an image in parallel (each calling countDown() >> when >> done) and when all threads are finished, some logic (i.e. drawing to >> screen) >> needs to be executed. And then start all over again. >> >> I didn't find anything that fits in j.u.c. :-\ >> >> thx >> _______________________________________________ >> Concurrency-interest mailing list >> Concurrency-interest@... >> http://cs.oswego.edu/mailman/listinfo/concurrency-interest > _______________________________________________ > Concurrency-interest mailing list > Concurrency-interest@... > http://cs.oswego.edu/mailman/listinfo/concurrency-interest _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://cs.oswego.edu/mailman/listinfo/concurrency-interest |
| Free embeddable forum powered by Nabble | Forum Help |