19 | | 3. A function wants to call a method on another thread and wait until it is done. Allowing callbacks resulting from that to run in the web worker thread. |
20 | | This does look suspiciously like a nested message loop with a filter which many people regard as evil. The only reason to allow this capability is for synchronous calls from javascript to call to the main thread to get some work done and act like a synchronous call but there may be callbacks (e.g. when doing a sync xhr call.) Theoretically, the javascript engine could roll up its state into a closure and we could avoid the nested message loop but that capability doesn't exist in the engines that we deal with and would be very expensive to add to them.[[BR]] |
| 19 | 3. A function wants to call a method on another thread and wait until it is done and allow callbacks resulting from that to run in the originating thread.[[BR]] |
| 20 | This looks like a nested message loop with a filter which is generally regarded as bad. The only reason to allow this capability is for synchronous calls from javascript to call to the main thread to get some work done and act like a synchronous call but there may be callbacks (e.g. when doing a sync xhr call.) Theoretically, the javascript engine could roll up its state into a closure and we could avoid the nested message loop but that capability doesn't exist in the engines that we deal with and would be very expensive to add to them.[[BR]] |