Asynchronism in Action Script 3.0

ぐ巨炮叔叔 提交于 2019-12-24 08:29:02

问题


I wonder, how is asynchronism implemented in AS3? Lets take the Timer class. A timer runs asynchronously and dispatches some events. Seems like it creates a new thread for himself. And how are the functions, called when timer event occurs, being thread safe? How is thread safety implemented in AS3?


回答1:


AS3 now supports multi threading using "ActionScript Workers" in the latest build. You can see how it is used here in this preview...

http://www.bytearray.org/?p=4423




回答2:


AS3 [used to be] not multithreaded.

Prior to Flash Player 11.4, everything ran on the main (single) thread, which is why things like Timer classes could be notoriously inaccurate if the CPU gets bogged down with some heavy processing.

As of Flash Player 11.4, Worker objects were introduced, providing the ability to create multiple threads.



来源:https://stackoverflow.com/questions/12354509/asynchronism-in-action-script-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!