tidev / ti.worker

Use Multi-Threading / Worker Threads in Appcelerator Titanium.
Other
96 stars 27 forks source link

Needed to use setTimeout with at least 1 millisecond for postMessage to task #2

Open ewindso opened 12 years ago

ewindso commented 12 years ago

Just fyi... I was following the example but it wasn't working... but when I did a setTimeout() with 1 millisecond for posting to the task, it worked.

Thanks btw -- this is great and what I've been waiting for for Titanium!

allenhartwig commented 12 years ago

Same problem here. It would be great to have a 'ready' event for the worker so we know when we can begin posting data to it... or have the createWorker method run synchronously.

allenhartwig commented 12 years ago

I'm finding that I need a timeout upwards of 1000ms otherwise if worker.postMessage(...) is called from within the worker script, it won't fire properly. This results in no error on SDK 2.0.2, however, on 2.1.0 it errors out with:

unrecognized selector sent to instance

on the line within the worker script calling the postMessage method.