HomePhabricator

Merge #12422: util: Make LockDirectory thread-safe, consistent

Description

Merge #12422: util: Make LockDirectory thread-safe, consistent

Summary:
1d4cbd2 test: Add unit test for LockDirectory (Wladimir J. van der Laan)
fc888bf util: Fix multiple use of LockDirectory (Wladimir J. van der Laan)

Pull request description:

Wrap the `boost::interprocess::file_lock` in a `std::unique_ptr` inside the map that keeps track of per-directory locks.

This fixes a build issue with the clang 4.0.0+boost-1.58.0p8 version combo on OpenBSD 6.2, and should have no effect otherwise.

Also add a unit test, make the function thread-safe, and fix Linux versus Windows behavior inconsistency.

Meant to fix #12413.

Tree-SHA512: 1a94c714c932524a51212c46e8951c129337d57b00fd3da5a347c6bcf6a947706cd440f39df935591b2079995136917f71ca7435fb356f6e8a128c509a62ec32

Backport of Core PR 12422
https://github.com/bitcoin/bitcoin/pull/12422/files
Completes T607
Depends on D2808

Test Plan: make check

Reviewers: deadalnix, Fabien, #bitcoin_abc

Reviewed By: deadalnix, #bitcoin_abc

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

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Feb 15 2018, 21:02
jasonbcoxCommitted on Apr 17 2019, 15:04
jasonbcoxPushed on Apr 17 2019, 15:04
Reviewer
Restricted Project
Differential Revision
D2809: Merge #12422: util: Make LockDirectory thread-safe, consistent
Parents
rABC797636646c7c: Merge #11904: Add a lock to the wallet directory
Branches
Unknown
Tags
Unknown