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: http://apache-flex-users.2333346.n4.nabble.com/

Reply via email to