Page MenuHomePhabricator

Limit scope of all global std::once_flag
ClosedPublic

Authored by PiRK on Feb 23 2021, 17:15.

Details

Reviewers
majcosta
Group Reviewers
Restricted Project
Commits
rABC5dc4b6e02fce: Limit scope of all global std::once_flag
Summary

once_flag is a helper (as the name might suggest) to execute a callable only once. Thus, the scope of the flag does never need to extend beyond where the callable is called. Typically this is function scope.

Move all the flags to function scope to

simplify code review
avoid mistakes where similarly named flags are accidentally exchanged
avoid polluting the global scope

This is a backport of core#19111

Depends on D9260

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable