Opened on 10/08/2014 at 04:18:17 PM
Last modified on 11/18/2014 at 02:58:04 PM
#1467 new change
[Stop using ATL] Convert ATL mutexes to standard library ones.
Reported by: | eric@adblockplus.org | Assignee: | |
---|---|---|---|
Priority: | P4 | Milestone: | |
Module: | Adblock-Plus-for-Internet-Explorer | Keywords: | ATL |
Cc: | oleksandr@adblockplus.org | Blocked By: | |
Blocking: | #276 | Platform: | Internet Explorer |
Ready: | yes | Confidential: | no |
Tester: | Verified working: | no | |
Review URL(s): |
Description
Background
The current code uses the ATL class CComAutoCriticalSection. The C++11 standard library provides std::mutex for this purpose.
What to change
Replace CComAutoCriticalSection with std::mutex. As a rule, locking a mutex should be done by std::unique_lock for exception safety.
Attachments (0)
Change History (3)
Note: See
TracTickets for help on using
tickets.
I would recommend to use std::recursive_mutex instead of std::mutex, it's much safer. And std::lock_guard instead of std::unique_lock when it's possible, because in most cases we need the functionality of only lock_guard, so we don't expect anything more, the result is less number of mistakes and better readability. Not sure, but lock_guard can be even lighter.