Make it possible to pass more than just NS_DISPATCH_AT_END from a TaskQueue
Categories
(Core :: XPCOM, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: KrisWright, Assigned: KrisWright)
References
Details
Attachments
(1 file)
In Bug 1593812, a dispatch flag was added specifically for I/O awareness in the background thread pool [1]. This flag determines if the runnable needs to be dispatched to the general purpose background thread pool or the I/O background thread pool. However, if a TaskQueue running with NS_DISPATCH_EVENT_MAY_BLOCK
has more tasks left in its queue, it will send itself to dispatch again to the wrong thread pool because it ignores its original flag and dispatches with NS_DISPATCH_AT_END
[2].
I think the most straightforward way to fix it is to add an optional additional dispatch flag field specifically for flags like NS_DISPATCH_EVENT_MAY_BLOCK
which determine which thread pool to dispatch in, assuming this issue may arise again later. In the future it may be worthwhile to create some way to pass more information than just a flag to dispatch.
[1] https://searchfox.org/mozilla-central/rev/0815480479c19646f9330377ffd8730515fca4ec/xpcom/threads/nsIEventTarget.idl#175
[2] https://searchfox.org/mozilla-central/rev/0815480479c19646f9330377ffd8730515fca4ec/xpcom/threads/TaskQueue.cpp#227
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
Makes TaskQueue's queue hold a struct with each runnable and its flags. When specified, flags will be stored and passed with NS_DISPATCH_AT_END when TaskQueue::Runner dispatches itself back to its event target.
Updated•4 years ago
|
Pushed by kwright@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/473309c218b7 Make TaskQueue capable of retaining its dispatch flags r=froydnj
Comment 3•4 years ago
|
||
bugherder |
Description
•