Mistake on this page?
Report an issue in GitHub or email us

Thread safety and porting

The thread safety documentation is available in our Reference section.

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 port_read, port_write, gpio_read and gpio_write, which are expected to use processor-specific set and 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.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.