[TIMOB-15276] iOS: Unable to create a multithreaded Titanium Mobile module
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2016-12-27T13:48:36.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Ingo Muschenetz |
Assignee | Eric Merriman |
Created | 2013-09-18T22:30:38.000+0000 |
Updated | 2017-03-23T22:28:34.000+0000 |
Description
Multithreading seems to be broken in Appcelerator iOS modules. Threads created within a proxy API method never ran, unless we added ENSURE_UI_THREAD_1_ARG(arg) to the start of the method.
This is not ideal having the initial method run on the UI thread, but under the circumstances acceptable, as the bulk of the work then happens inside a further (non UI) thread, relieving the UI thread very quickly.
Suggestion is to use TiThreadPerformOnMainThread instead of ENSURE_UI_THREAD_1_ARG, as that allows for a block to run inside the main thread while the rest is still in the JS background thread.
The suggestion is correct. Using
TiThreadPerformOnMainThread
the block will be ran on the main thread without leaking context to different threads. Resolving ticket.Closing ticket as Won't Fix with reference to the above comments.