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


EventFlags class hierarchy

The EventFlags class provides a mechanism for setting and waiting for specific conditions. It provides a generic way of notifying other threads about conditions or events. You can think of each instance of the EventFlags class as an event channel. There are 31 different flags available for each event.

EventFlag class reference

Public Member Functions
 EventFlags ()
 EventFlags (const char *name)
uint32_t set (uint32_t flags)
uint32_t clear (uint32_t flags=0x7fffffff)
uint32_t get () const
uint32_t wait_all (uint32_t flags=0, uint32_t timeout=osWaitForever, bool clear=true)
uint32_t wait_any (uint32_t flags=0, uint32_t timeout=osWaitForever, bool clear=true)
 ~EventFlags ()

EventFlags example

Below is an example of EventFlags usage, where one thread is generating events every 1s, and the second thread is waiting for the events and executing some action.

#include "mbed.h"

EventFlags event;

void worker_f()
    while (true) {

        printf("Got signal!\r\n");

int main()
    Thread worker;


    while (true) {
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.