Await for all fibers created from PoolFiberFactory to stop.

16 views
Skip to first unread message

Victor Hugo Borja

unread,
Nov 26, 2009, 12:35:24 PM11/26/09
to jetlang-dev
Hi,

I'm writing a prototype application using jetlang. I've created a
PoolFiberFactory, and then a lot of fibers from it, at some point my
application needs to wait for all fibers to be finished, however I
don't have a fixed number of fibers, so I guess a CountDownLatch would
not be very useful. Can any one provide an example of how to do
this?.

Thanks !

peter royal

unread,
Nov 26, 2009, 10:03:05 PM11/26/09
to jetla...@googlegroups.com

A CountDownLatch would be my first suggestion.. Can you explain more why it won't work in your situation?

If you know how many active Fibers you have at the time you want to wait for them to finish *and* you know that the Fiber won't be receiving any more events from Channels, you could execute a task directly on the Fiber that decrements the CDL.

-pete

--
(peter.royal|osi)@pobox.com - http://fotap.org/~osi

Reply all
Reply to author
Forward
0 new messages