Книга: Real-Time Concepts for Embedded Systems

7.7.4 Broadcast Communication

7.7.4 Broadcast Communication

Some message-queue implementations allow developers to broadcast a copy of the same message to multiple tasks, as shown in Figure 7.9.


Figure 7.9: Broadcasting messages.

Message broadcasting is a one-to-many-task relationship. tBroadcastTask sends the message on which multiple tSink-Task are waiting.

Pseudo code for broadcasting messages is provided in Listing 7.4.

Listing 7.4: Pseudo code for broadcasting messages.

tBroadcastTask () {
 :
 Send broadcast message to queue
 :
}
Note: similar code for tSignalTasks 1, 2, and 3.
tSignalTask () {
 :
 Receive message on queue
 :
}

In this scenario, tSinkTask 1, 2, and 3 have all made calls to block on the broadcast message queue, waiting for a message. When tBroadcastTask executes, it sends one message to the message queue, resulting in all three waiting tasks exiting the blocked state.

Note that not all message queue implementations might support the broadcasting facility. Refer to the RTOS manual to see what types of message-queue-management services and operations are supported.

Оглавление книги


Генерация: 1.406. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз