Support atomic load and store
Opened this issue · 5 comments
LnnrtS commented
This works out of the box
std::atomic<uint32_t> tmp;
tmp = 123;
this doesn't
std::atomic<uint64_t> tmp;
tmp = 123;
because of this
in function `std::__atomic_base<unsigned long long>::store(unsigned long long, std::memory_order)':
undefined reference to `__atomic_store_8'
ilg-ul commented
I don't remember anything about using atomic operations in µOS++.
Where do the atomic definitions come from?
LnnrtS commented
I don't know but I could imagine it knows that the architecture supports atomic operations under some circumstances (everything smaller than words) without further measures.
ilg-ul commented
Then probably it comes from the compiler definitions.
How do you suggest to fix it?
LnnrtS commented
How do you suggest to fix it?
I haven't though much about it but I would guess the actual access has to happen inside some critical section.
ilg-ul commented
inside some critical section
AFAIK, atomics are implemented with some special instructions, not explicit critical sections.