Thread safety and porting
Considerations when porting
Drivers that operate below the C HAL layer don't need synchronization mechanisms because this is already provided at a higher level. The only exceptions to this are the functions
gpio_write, which are expected to use processor-specific
clear registers rather than performing a read-modify-write sequence. For more information, see the example.
HAL C API
The HAL C API is the porting layer of Mbed OS and is not thread safe. Developers should not typically use this API directly, instead using the higher-level drivers and libraries. If you program directly to the HAL C API, it is your responsibility to synchronize operations with an appropriate mechanism, such as a mutex.