Closed Bug 1411501 Opened 7 years ago Closed 7 years ago

Runnable is not executed as expected when TailDispatching, Non-TailDispatching TaskQueue are mix-used.

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: kikuo, Unassigned)

Details

During the investigation on Bug 1313449,
I posted a patch which invokes |mOnWaitingForKeyEvent->Notify| [1] on a Non-TailDispatching thread (IPC receiver).
And there's also a case which|mOnWaitingForKeyEvent->Notify| is invoked on MFR's TaskQueue [2].


I found sometimes the dispatched runnables are not executed in order as expected.
[2] will be invoked before [1], but the runnable created by [1] is executed earlier than the one created by [2].

So the testing scenario would be exactly like TestTaskQueue.cpp [3] and setting tq2's aSupportsTailDispatch to false.

Is this a bug or it's intentional by the design here [4] ?


[1] https://bugzilla.mozilla.org/attachment.cgi?id=8920054&action=diff#a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp_sec4
[2] http://searchfox.org/mozilla-central/rev/d30462037ffea383e74c42542c820cf65b2b144e/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp#50
[3] http://searchfox.org/mozilla-central/source/xpcom/tests/gtest/TestTaskQueue.cpp
[4] http://searchfox.org/mozilla-central/rev/d30462037ffea383e74c42542c820cf65b2b144e/xpcom/threads/TaskQueue.cpp#245-246
Flags: needinfo?(jwwang)
Per offline discussion, when tail dispatching is enabled, Dispatch() doesn't queue the task in the event queue of the target thread immediately, instead the task is stored in the tail dispatcher queue and the real dispatching happens in the tail dispatching phase.

So this is not a bug, but just the way it works.
Flags: needinfo?(jwwang)
Thanks for the explanation.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.