Great. The information about how dispatchEvent() works is very helpful, too.
Thanks! Jon On Fri, Aug 28, 2009 at 12:16 AM, Gordon Smith<[email protected]> wrote: > > > Yes, that is what Alex is saying. Handler B will not begin before handler A > finishes. Event handlers don't get paused. Furthermore, when you (or the > Player) calls dispatchEvent(), all the event handlers listening for that > event execute before dispatchEvent() returns. > > > > Gordon Smith > > Adobe Flex SDK Team > > > > From: [email protected] [mailto:[email protected]] On > Behalf Of Jon Gunnip > Sent: Thursday, August 27, 2009 5:21 PM > To: [email protected] > Subject: Re: [flexcoders] Race conditions when event handlers triggered from > different targets > > > > > > Alex, > > Thanks. Just to be clear, are you saying that once event handler A' > begins executing, another event handler B' will not begin executing > until A' finishes? > > Even in a single-threaded environment, not knowing how the flash > player works, it is possible that the player could decide to "pause" > an executing event handler to allow another to progress. That would > create the scenario I am describing. > > Jon > > On Thu, Aug 27, 2009 at 6:54 PM, Alex Harui<[email protected]> wrote: >> Because actionscript is single-threaded, your scenario cannot happen. >> >> Alex Harui >> Flex SDK Developer >> Adobe Systems Inc. >> Blog: http://blogs.adobe.com/aharui >> >> >> -----Original Message----- >> From: [email protected] [mailto:[email protected]] On >> Behalf Of Jon Gunnip >> Sent: Thursday, August 27, 2009 1:49 PM >> To: [email protected] >> Subject: Re: [flexcoders] Race conditions when event handlers triggered >> from different targets >> >> Thanks, Tracy. I'm not principally concerned with knowing when two >> operations have completed. I'm more concerned about checking the >> status of a global variable in event handler A' and then having that >> variable's value changed by event handler B' before A' is finished >> executing. In Java you might use a synchronized block for this. I >> was hoping the flash player might make some guarantees that make a >> concern like this unnecessary, especially since it executes in a >> single thread. >> >> Are there any resources that describe the internals of the Flash >> player? Is there a spec like there is for the Java runtime? >> >> Thanks, >> Jon >> >> On Thu, Aug 27, 2009 at 12:44 PM, Tracy Spratt<[email protected]> wrote: >>> >>> >>> You can't predict order, but you can be assured that there is no parallel >>> processing of actionscript code. I don't know the internals of the flash >>> player well enough to say in detail but there are rules that control what >>> code is processed when. >>> >>> >>> >>> If you need to know that two async processes have completed, use a flag >>> or >>> dictionary, set a flag value in each handler, and check it in each >>> handler. >>> >>> >>> >>> Tracy Spratt, >>> >>> Lariat Services, development services available >>> >>> ________________________________ >>> >>> From: [email protected] [mailto:[email protected]] On >>> Behalf Of Jon Gunnip >>> Sent: Thursday, August 27, 2009 10:04 AM >>> To: [email protected] >>> Subject: [flexcoders] Race conditions when event handlers triggered from >>> different targets >>> >>> >>> >>> >>> >>> Hi, >>> >>> I have a concern about possible race conditions in our Flex >>> application. I've read in "Essential ActionScript 3.0" that the Flash >>> runtime will not interrupt the execution of an event handler to update >>> the screen. I'm wondering if there are any similar guarantees about >>> the order in which two event handlers registered with different >>> targets are executed. Consider the following: >>> >>> User presses button A triggering event handler A' >>> In same frame, result returned from HTTPService B, triggering event >>> handler >>> B' >>> >>> If A' starts executing before B', will it run to completion before B' >>> starts executing, or could their execution be interleaved? >>> >>> Thanks, >>> Jon >>> >>> >> >> >> ------------------------------------ >> >> -- >> Flexcoders Mailing List >> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt >> Alternative FAQ location: >> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 >> Search Archives: >> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links >> >> >> >> >> >> ------------------------------------ >> >> -- >> Flexcoders Mailing List >> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt >> Alternative FAQ location: >> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 >> Search Archives: >> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links >> >> >> >> > >

