Limit scope of all global std::once_flag #19111

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2005-NoGlobalOnce changing 3 files +4 −5
  1. MarcoFalke commented at 9:26 PM on May 29, 2020: member

    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
  2. Limit scope of all global std::once_flag fa9c675591
  3. MarcoFalke added the label Refactoring on May 29, 2020
  4. hebasto commented at 6:27 AM on May 30, 2020: member

    Concept ACK. Is g_ prefix in variable names still relevant now?

  5. MarcoFalke commented at 10:53 AM on May 30, 2020: member

    Is g_ prefix in variable names still relevant now?

    Yes, they still have static storage duration, also the diff is smaller keeping it. Finally, to keep code consistent with other instances like g_logger.

  6. hebasto approved
  7. hebasto commented at 12:04 PM on May 30, 2020: member

    ACK fa9c67559186f5416c1c0b26c0a1d5e72c234ccb, tested on Linux Mint 19.3 (x86_64).

  8. promag commented at 10:56 AM on June 2, 2020: member

    Code review ACK fa9c67559186f5416c1c0b26c0a1d5e72c234ccb.

  9. MarcoFalke merged this on Jun 2, 2020
  10. MarcoFalke closed this on Jun 2, 2020

  11. MarcoFalke deleted the branch on Jun 2, 2020
  12. sidhujag referenced this in commit 3dc8e76322 on Jun 2, 2020
  13. zkbot referenced this in commit 5ef5d8d268 on Jul 31, 2020
  14. zkbot referenced this in commit 7d94064616 on Sep 29, 2020
  15. Fabcien referenced this in commit 5dc4b6e02f on Feb 24, 2021
  16. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me