272
edits
m (→From JS) |
m (→darin:) |
||
Line 281: | Line 281: | ||
==== darin: ==== | ==== darin: ==== | ||
* When asked to shutdown, a thread would finish dispatching all queued | * When asked to shutdown, a thread would finish dispatching all queued events, and refuse to accept any new events. Once all queued events run to completion, the thread would terminate. This is consistent with how event queues work today. | ||
* If you are sync dispatching, then it is necessary to pump events on the calling thread or else you could end up in a dead-lock situation. For example, if thread A sync dispatches | * If you are sync dispatching, then it is necessary to pump events on the calling thread or else you could end up in a dead-lock situation. For example, if thread A sync dispatches an event to thread B, which cannot complete its job without dispatching an event back to thread A, then the system will dead-lock unless thread A continues to dispatch pending events. | ||
* | * <code>ProcessNextEvent</code> may be called by anybody that wishes to implement the concept of a "modal event loop." For example, XMLHttpRequest (in sync configuration) would sit in a loop calling <code>ProcessNextEvent</code> while waiting for the underlying HTTP transaction to complete. The key difference between <code>ProcessNextEvent</code> and <code>nsIEventQueue::ProcessPendingEvents</code> is that <code>ProcessNextEvent</code>, when called on the UI thread, will process UI events as well. And, it will also wait (block the thread of execution) if there are no UI events or pending <code>nsIRunnable</code> events. |
edits