Real-Time Embedded Multithreading: Using ThreadX and ARM

Chapter 11: Synchronization of Threads Using Event Flags Groups

11.1 Introduction

Event flags provide a powerful tool for thread synchronization. Event flags can be set or cleared [46] by any thread and can be inspected by any thread. Threads can suspend while waiting for some combination of event flags to be set. Each event flag is represented by a single bit. Event flags are arranged in groups of 32 as illustrated by Figure 11.1.

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

31

30

29

28

27

26

25

24

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

Figure 11.1: An event flags group

Threads can operate on all 32 event flags in a group simultaneously. To set or clear event flags, you use the tx_event_flags_set service and you get them (wait on them) with the tx_event_flags_get service.

Setting or clearing event flags is performed with a logical AND or OR operation between the current event flags and the new event flags. The user specifies the type of logical operation (either AND or OR) in the call to the tx_event_flags_set service.

There are similar logical options for getting event flags. A get request can specify that all specified event flags are required (a logical AND). Alternatively, a get request can specify that any of...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Banner and Flag Making Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.