Add Atomic<T> template

Add a C++ `Atomic<T>` template to make atomics even easier. Basically
compatible with C++11 `std::atomic<T>`, but using the underlying
`core_util_atomic_xxx` functions from mbed_atomic.h, so appropriate for
synchronising with interrupts and optimised for uniprocessor.

One extra piece of functionality beyond the `core_util_atomic_xxx`
functions is the ability to have an arbitrary atomic type - eg a small
structure with 2 `uint16_t`s can be stored in a `uint32_t` container.
pull/10274/head
Kevin Bracey 2019-03-29 16:42:13 +02:00
parent 5d2b37d205
commit f9f073245b
2 changed files with 1237 additions and 1 deletions

2
mbed.h
View File

@ -88,7 +88,7 @@
#include "drivers/InterruptIn.h"
#include "platform/mbed_wait_api.h"
#include "hal/sleep_api.h"
#include "platform/mbed_atomic.h"
#include "platform/Atomic.h"
#include "platform/mbed_power_mgmt.h"
#include "platform/mbed_rtc_time.h"
#include "platform/mbed_poll.h"

1236
platform/Atomic.h Normal file

File diff suppressed because it is too large Load Diff