Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop using atomic_flag_*() for atomic_int in mutex
The atomic_flag_* functions are only defined for operands of the type atomic_flag so the previous implementation relied on undefined behavior. Because of the need for a read without side effects (in __metal_mutex_is_acquired), it is not possible to use the atomic_flags type for the mutex implementation. Because of this, all atomic_flag_* functions are replaced with the appropriate functions for atomic value types. Signed-off-by: Simon Leiner <simon@leiner.me>
- Loading branch information
Showing
2 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9a3162e
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.
Hi,
I'm aware that these changes are merged. But, just checking if there is an fallback option for processors that does not support atomic operations. As an example, Cortex-M0 (ArmV6M) does not support atomic operations, this means, atomic_compare_exchange_weak can't be used as the compiler can't generate code for __sync_val_compare_and_swap
9a3162e
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.
Hi @vishnu-banavath
it a concerns or an issue you detected?
Do you have a look to https://github.com/OpenAMP/libmetal/blob/master/lib/compiler/gcc/atomic.h?
If there is an issue don't hesitate to enter a github issue