Skip to content

#9: Fix bug in std::call_once#10

Merged
fnrizzi merged 2 commits intomainfrom
9-fix-bug-in-stdcall_once
Apr 8, 2025
Merged

#9: Fix bug in std::call_once#10
fnrizzi merged 2 commits intomainfrom
9-fix-bug-in-stdcall_once

Conversation

@cwschilly
Copy link
Copy Markdown
Contributor

@cwschilly cwschilly commented Mar 27, 2025

Fixes #9

For now, this only cleans up initialization and adds a warning in the README about the bug. I've created #15 as a follow-on to ensure that the logger works even when threading is not enabled by the compiler.

@cwschilly cwschilly self-assigned this Mar 27, 2025
@cwschilly cwschilly linked an issue Mar 27, 2025 that may be closed by this pull request
@cwschilly cwschilly force-pushed the 9-fix-bug-in-stdcall_once branch from 2a7646d to ac94121 Compare April 8, 2025 13:39
@cwschilly cwschilly marked this pull request as ready for review April 8, 2025 13:58
@cwschilly cwschilly requested a review from fnrizzi April 8, 2025 13:58
setLoggingLevel(LogLevel::none);
logger_is_initialized_.store(false, std::memory_order_release);
init_flag_ = std::make_unique<std::once_flag>();
init_warning_flag_ = std::make_unique<std::once_flag>();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines allow a user to initialize the logger again after it has been finalized (e.g. for testing purposes).

@fnrizzi fnrizzi merged commit ab34b25 into main Apr 8, 2025
4 checks passed
@fnrizzi fnrizzi deleted the 9-fix-bug-in-stdcall_once branch April 17, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown error -1 thrown by std::call_once

2 participants