micro-os-plus/micro-os-plus-iii

Support atomic load and store

Opened this issue · 5 comments

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'

I don't remember anything about using atomic operations in µOS++.

Where do the atomic definitions come from?

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.

Then probably it comes from the compiler definitions.

How do you suggest to fix it?

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.

inside some critical section

AFAIK, atomics are implemented with some special instructions, not explicit critical sections.