Race-condition With Web Workers When Setting Onmessage Handler?
Please consider the following code and the explanation from this Mozilla tutorial 'Using web workers': var myWorker = new Worker('my_worker.js'); myWorker.onmessage = function(even
Solution 1:
The answer is that both the main script and the web worker have a MessagePort queue which collects the messages before the initial worker script returns.
For details, see this thread on the WHATWG help mailing list: http://lists.whatwg.org/pipermail/help-whatwg.org/2010-August/000606.html
Post a Comment for "Race-condition With Web Workers When Setting Onmessage Handler?"