The usage of MilliSleep() in SeedPeriodic (previously SeedSleep) was
removed in #17270, meaning it, and its users can now be marked noexcept.
This also corrects the docs in random.h for some of the changes in #17270.
The usage of MilliSleep() in SeedPeriodic (previously SeedSleep) was
removed in #17270, meaning it, and its users can now be marked noexcept.
459 | - * this sleeping logic, so they are noexcept. The same is true for all the 460 | - * GetRand*() functions that use GetRandBytes() indirectly. 461 | - * 462 | - * TODO: After moving away from interruptible boost-based thread management, 463 | - * everything can become noexcept here. 464 | + * None of the RNG code should ever throw any exception.
Very good :+1:
ACK 55b2cb199c276781b6daa5438af2da57dea3ac52
Very nice!
Somewhat related: it would be nice to have the same explicit guarantee for LogPrint/LogPrintf. That would allow compilers and static analyzers to treat a larger parts of our code base as "non-throwing" instead of "potentially throwing" :)
Somewhat related: it would be nice to have the same explicit guarantee for LogPrint/LogPrintf.
Wouldn't that be easy to do? LogPrintf already catches the only relevant exception, tinyformat::format_error, internally. I don't think any exceptions are supposed to leak out of it.
@laanwj Yes, exactly! It is only a matter of formalizing that with a noexcept :)
@practicalswift Wouldn't upstream be a better place to propose this change?
@MarcoFalke Upstream throws tinyformat::format_error which we catch: thus noexcept only makes sense on our end of things, no? :)
Fine, but LogPrintStr is also called, which might throw exceptions. In either case, this discussion should happen elsewhere.
ACK 55b2cb199c276781b6daa5438af2da57dea3ac52
I don't think LogPrintStr is supposed to ever raise an exception, but sure, that'd need to be checked. Agree this is off topic here.
ACK 55b2cb199c276781b6daa5438af2da57dea3ac52
@laanwj @MarcoFalke Please note that SeedPeriodic which is annotated noexcept in this PR calls LogPrintf:
Thus the question of a noexcept annotation for LogPrintf is not entirely off topic here :)
Thus the question of a noexcept annotation for LogPrintf is not entirely off topic here :)
Sure. I'm going to work on a PR to make logging noexcept.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
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.