Skip to content

random: Add missing thread-safety annotations for events_hasher #17666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

practicalswift
Copy link
Contributor

Add missing thread-safety annotations for events_hasher (GUARDED_BY(events_mutex)).

Context: #17573 (comment) :)

@laanwj
Copy link
Member

laanwj commented Dec 4, 2019

Thanks for adding

ACK e4833ee

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 5, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17670 (Move events_hasher into RNGState() by sipa)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@practicalswift
Copy link
Contributor Author

Closing in favour of #17670.

maflcko pushed a commit that referenced this pull request Dec 5, 2019
8bda096 Move events_hasher into RNGState() (Pieter Wuille)

Pull request description:

  This moves `events_hasher` and `events_mutex` into `RNGState()` in random.cpp. This guarantees (through the existing `GetRNGState()` function) that the mutex is always created before any events are added, even when that happens inside global initializers.

  Fixes the issue reported here: #17573 (comment), and includes the annotation from #17666).

ACKs for top commit:
  MarcoFalke:
    re-ACK 8bda096 🥈
  sipsorcery:
    re-ACK 8bda096.

Tree-SHA512: 78702d668764df19e9d61d87d82eca71cceca87d5351b740e13e732a1c18a3d53d7fbaaf63245266da597370bfebec9fa6a4749c15ec5a78dcfe6122c33553ed
@practicalswift practicalswift deleted the GUARDED_BY(events_mutex) branch April 10, 2021 19:39
knst pushed a commit to knst/dash that referenced this pull request May 26, 2022
8bda096 Move events_hasher into RNGState() (Pieter Wuille)

Pull request description:

  This moves `events_hasher` and `events_mutex` into `RNGState()` in random.cpp. This guarantees (through the existing `GetRNGState()` function) that the mutex is always created before any events are added, even when that happens inside global initializers.

  Fixes the issue reported here: bitcoin#17573 (comment), and includes the annotation from bitcoin#17666).

ACKs for top commit:
  MarcoFalke:
    re-ACK 8bda096 🥈
  sipsorcery:
    re-ACK 8bda096.

Tree-SHA512: 78702d668764df19e9d61d87d82eca71cceca87d5351b740e13e732a1c18a3d53d7fbaaf63245266da597370bfebec9fa6a4749c15ec5a78dcfe6122c33553ed
knst pushed a commit to knst/dash that referenced this pull request May 27, 2022
8bda096 Move events_hasher into RNGState() (Pieter Wuille)

Pull request description:

  This moves `events_hasher` and `events_mutex` into `RNGState()` in random.cpp. This guarantees (through the existing `GetRNGState()` function) that the mutex is always created before any events are added, even when that happens inside global initializers.

  Fixes the issue reported here: bitcoin#17573 (comment), and includes the annotation from bitcoin#17666).

ACKs for top commit:
  MarcoFalke:
    re-ACK 8bda096 🥈
  sipsorcery:
    re-ACK 8bda096.

Tree-SHA512: 78702d668764df19e9d61d87d82eca71cceca87d5351b740e13e732a1c18a3d53d7fbaaf63245266da597370bfebec9fa6a4749c15ec5a78dcfe6122c33553ed
knst pushed a commit to knst/dash that referenced this pull request May 30, 2022
8bda096 Move events_hasher into RNGState() (Pieter Wuille)

Pull request description:

  This moves `events_hasher` and `events_mutex` into `RNGState()` in random.cpp. This guarantees (through the existing `GetRNGState()` function) that the mutex is always created before any events are added, even when that happens inside global initializers.

  Fixes the issue reported here: bitcoin#17573 (comment), and includes the annotation from bitcoin#17666).

ACKs for top commit:
  MarcoFalke:
    re-ACK 8bda096 🥈
  sipsorcery:
    re-ACK 8bda096.

Tree-SHA512: 78702d668764df19e9d61d87d82eca71cceca87d5351b740e13e732a1c18a3d53d7fbaaf63245266da597370bfebec9fa6a4749c15ec5a78dcfe6122c33553ed
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants