How to prevent HTML5 Web Workers from locking up thus correctly responding to messages from parent
问题 I'm using web workers to do some CPU intensive work but have the requirement that the worker will respond to messages from the parent script while the worker is still processing. The worker however will not respond to messages while it is locked in a processing loop, and I have not found a way to say poll the message queue. Thus it seems like the only solution is to break processing at an interval to allow any messages in the queue to be serviced. The obvious options are to use a timer (say