Hello. Sorry for my bad english.
I created a child worker that executes a loop.
I wish main worker could stop child worker execution when main worker
sends a message to child worker. But child worker doesn't "read"
messages until loop ends (onmessage event isn't firing until loop
ends).
I used timer.setTimeout but didn't work well... i've done somethig
like that inside child worker:
function foo(){
if ( ! messageRecievedFromMainWorker)
timer.setTimeout(function(){foo();}, 1);
}
But when I send a message to child, it doesn't read it until few
seconds has passed. I need that child worker process it immediately.
If instead 1 millisecond I pass 100 milliseconds as second argument to
setTimeout, it works ok, but execution of that loop (sometimes loops
more than 1000 times!) is too slow....
anybody can help me please?