Closed Bug 1618165 Opened 5 years ago Closed 5 years ago

Provide BaseAutoLock and BaseAutoUnlock deduction guides for Mutex references

Categories

(Core :: XPCOM, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: sg, Assigned: sg)

References

Details

Attachments

(1 file)

The typedefs

typedef BaseAutoLock<Mutex&> MutexAutoLock;
typedef BaseAutoLock<OffTheBooksMutex&> OffTheBooksMutexAutoLock;

are no longer necessary and deduction guides can be used instead to handle any Mutex reference.

BaseAutoLock can be renamed to MutexAutoLock and a deduction guide

template <typename MutexType>
MutexAutoLock(MutexType&)->MutexAutoLock<MutexType&>;

be defined instead.

All uses of BaseAutoLock and OffTheBooksMutexAutoUnlock must be changed to refer to MutexAutoLock in the course of this.

The same applies to BaseAutoUnlock etc.

Summary: Remove AutoLock typedefs in xpcom/threads/Mutex.h and provide deduction guides for Mutex references instead → Provide BaseAutoLock and BaseAutoUnlock deduction guides for Mutex references

Sorry, I was mistaken about the typedefs being no longer needed, they are required for use in function signatures. But still the deduction guides should be added to allow you to write:

BaseAutoLock lock(mutexOfTemplatedType);
Assignee: nobody → sgiesecke
Status: NEW → ASSIGNED
Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b6ce0a07d782 Provide BaseAutoLock and BaseAutoUnlock deduction guides for Mutex references. r=froydnj

Updated patch to fix Windows and OS X builds.

Flags: needinfo?(sgiesecke)
Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5d992fd39a39 Provide BaseAutoLock and BaseAutoUnlock deduction guides for Mutex references. r=froydnj
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Regressions: 1619206
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: