Closed Bug 1193245 Opened 10 years ago Closed 10 years ago

Using Atomic in the suspend count of the media resource

Categories

(Core :: Audio/Video, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

Details

Attachments

(1 file)

This bug is file from the bug1187092 comment34. We need to use Atomic in the |mSuspendCount|.
Depends on: 1187092
Please restate the problem so it is easier to understand what this bug tries to fix.
Blocks: 1187092
No longer depends on: 1187092
The problem is the lock is not always held when updating mSuspendCount which results in a data race. Since we are gonna move mSuspendCount into the suspend agent, and it is the only one member needing to be synchronized, we can just conveniently convert it to an Atomic to fix the data race.
Bug 1193245 - Using Atomic in the suspend count of the media resource. In present codebase, the |mSuspendCount| would be accessed in main thread and state machine thread, and we use the lock mechanism to avoid the race condition. However, we can use another more easier way to achieve it, that is using Atomic for the |mSuspendCount|.
Attachment #8646734 - Flags: review?(jwwang)
Attachment #8646734 - Flags: review?(jwwang) → review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
JW - should we be using atomic?
Flags: needinfo?(jwwang)
Per discussion on IRC and comment 3, we still prefer atomic over mutex for there is only one member to synchronize and atomic is more efficient and easier to use than mutex.
Flags: needinfo?(jwwang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: