HomePhabricator

Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection

Description

Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection

Summary:

  • Add unit test for DEBUG_LOCKORDER code
  • MOVEONLY Move AnnotatedMixin declaration

Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER
function declarations so it can call them.

  • Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection

They should also work with any other mutex type which std::unique_lock
supports.

There is no change in behavior for current code that calls these macros with
CCriticalSection mutexes.

  • Use LOCK macros for non-recursive locks

Instead of std::unique_lock.

This is a backport of Core PR11640

Depends on D1922

Test Plan:

make check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: jasonbcox, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1923

Details

Provenance
Russell Yanofsky <russ@yanofsky.org>Authored on Nov 8 2017, 20:28
deadalnixCommitted on Oct 16 2018, 07:47
deadalnixPushed on Oct 16 2018, 07:47
Reviewer
Restricted Project
Differential Revision
D1923: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection
Parents
rABCb231991c0bcf: [net] Thread safety annotations in net_processing
Branches
Unknown
Tags
Unknown