-
Notifications
You must be signed in to change notification settings - Fork 10
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
feature switch for thread_local variables and multi-threading #159
feature switch for thread_local variables and multi-threading #159
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
=======================================
Coverage 93.87% 93.87%
=======================================
Files 27 27
Lines 1664 1664
=======================================
Hits 1562 1562
Misses 102 102
Continue to review full report in Codecov by Sentry.
|
The CI failures weren't related to this PR and have been fixed in |
thread local variables will trigger a memory allocation on a bare metal system. use a macro to define the variable as thread local. Bare metal by definition has no threads and so needs no qualifier.
Cleanup of option documentation, usage, and meson configuration. Based on code review in merge request from cschreib.
af299a1
to
73f4935
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you for your contribution.
thread local variables will trigger a memory allocation on a bare metal system. When running tests on a single thread, or a system without threads, there is no benefit to using a
thread_local
variable. As discussed in #158.This change creates a feature flag to control if snitch should be compiled with support for threading. A macro
SNITCH_THREAD_LOCAL
is defined in the config header that resolves to nothing when the feature flag is disabled, orthread_local
when it is enabled. The feature flag is enabled by default to preserve existing behavior.I names the feature flag
SNITCH_WITH_MULTITHREADING
to let it be used for any future threading features as well. If you want a more granular option that is an easy change.I updated the CMake project file, and the meson options. I don't use meson so someone double checking my work there would be great. The change seems simple enough though 😄