-
Notifications
You must be signed in to change notification settings - Fork 34
Add util/atomic.h #350
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
Add util/atomic.h #350
Conversation
Hi Gunter, thanks for submitting this! Can you add (or just post here) a dummy/example usage of some |
Hi Ian,
ATOMIC_BLOCK takes either ATOMIC_RESTORESTATE or ATOMIC_FORCEON as parameter, while NONATOMIC_BLOCK takes either NONATOMIC_RESTORESTATE or NONATOMIC_FORCEOFF, so there are just four combinations in total. One more thing: Two of the checks fail for my pull request. I'm new to this project and I don't really know what's wrong. |
Where would a unit test go? Would arduino_ci/SampleProjects/TestSomething/ be the right place? |
Regarding the test failures, I think you can ignore the one with the linter -- it looks like a temporary problem with GitHub (and if not, I can look into it later). The only problem I'm seeing is a spelling error: https://github.com/Arduino-CI/arduino_ci/actions/runs/4424323994/jobs/7765538401?pr=350#step:4:19 Regarding a unit test, that would be awesome! Please call it something like |
I've added a unit test. As the macros don't do anything on the host, it just checks that all the four combinations compile without errors. |
This is excellent, thank you! |
Hi,
I had the problem that I wanted to check a library modified by me which in turn includes a library that includes util/atomic.h and that doesn't work, of course. I added a mocked version of util/atomic.h, that simply does nothing. Atomicity by switching off interrupts is not possible on the host OS but timing behavior will differ anyway, therefore I think this approach is acceptable.
Best,
Gunter