You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add function to allow checking thread type (#4645)
Closes#4613
This change adds a function `threadIsType` function to `Application`
that allows a thread to check its type. This is intended to support more
detailed assertions than the usual `releaseAssert(threadIsMain())`
assertions we're currently using everywhere.
The implementation differs a bit from the proposed solution in #4613 as
it uses a mapping in `ApplicationImpl` to track thread types, rather
than using static variables. I chose this approach because as far as I
can tell, it's not possible to assign a thread an id. Given that,
`ApplicationImpl` would need to set these variables in its constructor,
and the variables would hold meaningless values prior to that. I figure
it's safer to ensure that thread types can only be reasoned about after
the creation of the threads themselves in `ApplicationImpl`'s
constructor. However, if it's important that thread types be reasoned
about without an `Application` or `AppConnector`, then I'm open to
changing the design.
# Checklist
- [x] Reviewed the
[contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes)
document
- [x] Rebased on top of master (no merge commits)
- [x] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio
extension)
- [x] Compiles
- [x] Ran all tests
- [ ] If change impacts performance, include supporting evidence per the
[performance
document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
0 commit comments