I would try to find other examples of Workers.  I'm not sure trying to
copy the main thread into a worker thread is supported.

HTH,
-Alex

On 11/7/17, 5:38 PM, "jiteshks" <jites...@yahoo.com> wrote:

>Hi,
>
>I am trying to do a simple POC for my application to show that
>multi-threading can be implemented in our code.
>
>Basically, I am just calling worker.start() and expecting worker to start
>at
>some point of time after that. But it seems all executions are happening
>in
>main thread only. 
>
>*When is worker thread supposed to start?*
>
>Here is sample code that I have written :-
>
>public function execute(method:String, serviceResponder:IResponder,
>valueObject:IValueObject = null):AsyncToken
>               {
>
>                       var swfBytes:ByteArray = 
> Application.application.loaderInfo.bytes;
>                       trace("Coming in execute") ;
>                       if(Worker.current.isPrimordial) {
>                               trace("Main thread") ;
>                               var bgWorker:Worker = 
> WorkerDomain.current.createWorker(swfBytes);
>                               bgWorker.addEventListener(Event.WORKER_STATE, 
> workerStateHandler);
>                               bgWorker.start() ;
>                       }
>                       else {
>                               trace("Worker Thread!!") ;
>                       }
>
>}
>
>I expect "Worker Thread!!" to be printed at some point of time but all
>executions are going in *if* condition and none in *else *condition.
>
>Any idea why that would happen.
>
>
>
>--
>Sent from: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-users.2333346.n4.nabble.com%2F&data=02%7C01%7C%7Cb5c839ffcb3e4b3ab8c008d
>52674945d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636457204504721422&
>sdata=aEuq1lG8V32LR2TN84wC9OXxqGOCVVuJmrmz3mKRsz8%3D&reserved=0

Reply via email to