HomePhabricator

Prevent mutex lock fail even if --enable-debug

Description

Prevent mutex lock fail even if --enable-debug

Summary:
This PR intends to resolve #15227.

"configure --debug-enabled" enables "#ifdef DEBUG_LOCKORDER".
Then "lockdata" (in sync.cpp) will be initialized same as other
static objects.

But unfortunately, lockdata.push_lock() was called before its
initialization (via initializing signatureCache which is declared
in script/sigcache.cpp) on macOS.

This PR apply the "Construct On First Use Idiom" to "lockdata"
to prevent it.

This is a backport of Core PR15233

Depends on D3476

Test Plan:

make check

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Akio Nakamura <nakamura@dgtechnologies.co.jp>Authored on Jan 23 2019, 01:57
deadalnixCommitted on Jul 1 2019, 12:15
deadalnixPushed on Jul 1 2019, 12:15
Reviewer
Restricted Project
Differential Revision
D3484: Prevent mutex lock fail even if --enable-debug
Parents
rABC4d7ec287dbad: qa: Initialize lockstack to prevent null pointer deref
Branches
Unknown
Tags
Unknown