RTOS MAIL
The example 'send_thread' task uses the following code to allocate a buffer
void send_thread (void const *args) {
uint32_t i = 0;
while (true) {
i++; // fake data update
mail_t *mail = mail_box.alloc(); ******
mail->voltage = (i * 0.1) * 33;
The call to 'alloc' returns under all circumstances, e.g. when there are no buffers to be allocated. The result is that a fault occurs only when the buffer hits its limit.
void send_thread (void const *args) {
uint32_t i = 0;
while (true) {
i++; // fake data update
mail_t *mail = mail_box.alloc(osWaitForever); ******
mail->voltage = (i * 0.1) * 33;
will force the thread to wait until a buffer becomes available (assuming this is the effect you want).
The RTX documentation at Keil uses 'osWaitForever' in their example code.
Jim herd
RTOS MAIL
The example 'send_thread' task uses the following code to allocate a buffer
The call to 'alloc' returns under all circumstances, e.g. when there are no buffers to be allocated. The result is that a fault occurs only when the buffer hits its limit.
will force the thread to wait until a buffer becomes available (assuming this is the effect you want).
The RTX documentation at Keil uses 'osWaitForever' in their example code.
Jim herd