>>>>> "SG" == Simon Glover <[EMAIL PROTECTED]> writes:
SG> One quick point: unless I'm misunderstanding something, there seems to SG> be no easy way to wait on multiple events to complete if those events SG> can occur in any order. For instance, suppose we have 5 events, P1 - P5 SG> If we know that the events will occur in some specified order (say SG> 1-2-3-4-5), then we can just loop over C<wait Px>, specifying the SG> apporpriate x for each iteration. However, if the events actually occur SG> in the order 4-3-2-5-1, we'll drop events 2-5 while waiting for 1. SG> Now, this is fine if 1 _must_ happen before 2 etc., but often this is SG> more restrictive than we need to be, since all we really care about is SG> ensuring that all 5 events are handled before we do anything else. SG> Is there any easy and efficient way to do this with the current SG> framework? you have a callback for each event and it sets a flag (better idea below). when all the wanted flags are set, you post another event that all 5 things are done. your main code waits on that event. a nice way to handle the multiple flag things is with a hash and a callback. you preset the hash to all the keys you are waiting on. when each handler is triggered, it deleted its key (which can come from the private event data stored in the event itself) from the hash. when the hash is empty, trigger the callback. i call this a scatter (start the async actions) and gather (collect their done flags) operation. this is best done at a user level. let parrot handle each event individually. there is no major benefit to parrot doing this for you IMO as it is not system level at all. uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org