I used a timer to pause execution 100 miliseconds each loop and messages are processed ok, but execution is very slow!. I set miliseconds to 10 instead of 100, but message is processed too late.
About your second solution, how can I do it? I need the worker could process the message to stop the loop when message is received. If I create another worker, how can I stop the loop in the worker when message is handled by another worker? thanks On 8 jul, 00:36, skye <[email protected]> wrote: > Perhaps instead of having a constantly executing loop, you could set > up a Timer and have the loop execute at fixed times. This way your > worker thread would have free cycles to process the onMessage events? > Or maybe start another instance of a worker to specifically handle the > messages while the other worker processes in the loop? > > -s > > On Jul 7, 12:29 pm, Sergio Viudes <[email protected]> wrote: > > > I wrote a worker that has a big loop. If I send a message to this > > worker while loop is executing, it isn't readed until loop ends. I > > need message can be readed while executing that loop. > > > Anybody has any ideas? > > > Thanks
