Does Native Extension code in Adobe AIR for IOS run in a separate CPU Thread?

随声附和 提交于 2019-12-08 06:37:43

问题


I am building an IOS application using Flex 4.6 and AIR 3.3. I do have some Objective-C Libs that we will be using for processing audio, images, and video to create a new "video" file.

Being that we are doing all this processing on the device through a native extensions I am wondering if the user is going to see the app lock up till the processing is complete. In other words am I going to need to show them a progress bar and not allow them to do anything else in the app till this is complete OR does native extension code run in a separate thread ?

A secondary question would be ... If Native Code does not run in a separate thread is it possible to use the new Actionscript Workers to offload the processing to a separate thread ?


回答1:


Your ANE can invoke a new thread, so your app shouldn't lock up.

This is a very good reference for developing native extensions: http://help.adobe.com/en_US/air/extensions/air_extensions.pdf

To quote the relevant part: "The native C code can dispatch asynchronous events back to the ActionScript side of your extension. For example, an extension method can start another thread to perform some task. When the task in the other thread completes, that thread calls FREDispatchStatusEventAsync() to inform the ActionScript side of the extension. The target of the event is an ActionScript ExtensionContext instance."

Regarding the worker threads, yes, that's exactly what worker threads are for and from what I've read from the AS3 implementation, it'll work just like that. However, my best bet is that using an ANE will be faster for such tasks than using AS3. If you have the libs ready to roll, I'd just use an ANE and maybe try the worker threads once released for fun, might be easier to maintain if you're mostly developing in AS3.



来源:https://stackoverflow.com/questions/12038436/does-native-extension-code-in-adobe-air-for-ios-run-in-a-separate-cpu-thread

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