Threading in mbed OS

TL;DR: Is there such a thing as threading in mbed OS? If so, how can I write thread safe code?

So, mbed 2.0 had mbed RTOS for users who needed multithreaded applications or thread-safe library code. This was in turn built on CMSIS-RTOS. But what about mbed OS? I understand task scheduling and execution is managed by the Minar scheduler; is that the only way asynchronous activity is accomplished, or is there a way to write truely multi-threaded apps with mbed OS?

On the library side, if mbed OS is single-threaded, I would assume that there is no need to ensure code is thread-safe (e.g. using mutexes to access global variables). But if multithreaded apps are possible with mbed OS, where do I go for a mutex implementation? Should I use CMSIS implementations directly?

Hello,

threading is not supported for mbed-OS - meant to be single threaded applications. Thus for instance drivers are not thread safe.

1 Like

I’m just curious then, how does (or how should) a driver such as TCP/IP work? Does it post periodic callbacks to check for incoming packets? Or does the user have to call in to check? Or does it do a busy wait when a packet is expected?

We’ll be adding RTOS support to mbed OS soon; so please write thread-safe code :slight_smile:

We’ll be adding RTOS support to mbed OS soon; so please write thread-safe code

Yay! I’ll look forward to seeing that.