rtems_message_queue_receive / rtems_event_receive issues

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Oct 9 06:59:59 UTC 2018

On 09/10/2018 08:48, Catalin Demergian wrote:
> Hi,
> I put more debugging effort into this.
> I think it's all about the Wait.flags value when the ISR is arriving.
> For Wait.flags=BLOCKED or Wait.flags=INTEND_TO_BLOCK things are working
> (yes, _Thread_Unblock is called from _Event_Seize properly), but when 
> Wait.flags=READY
> things don't work because the conditions in if block 
> from _Event_Surrender are not met and
> nobody calls _Thread_Unblock; even if more ISRs arrive, Wait.flags 
> remains READY and the
> thread is not put on the CPU anymore.
> 1. how can Wait.flags be READY before the ISR is arriving ?

The wait flag name is THREAD_WAIT_STATE_READY_AGAIN. This is a state 
after a blocking operation. Such a thread is ready and either executes 
or the scheduler decided that it is not important enough and a higher 
priority thread executes.

> 2. on the else of the if block I tried to put unblock=true to unblock 
> my task
>   if (
>     _Event_Is_blocking_on_event( the_thread, wait_class )
>       && _Event_Is_satisfied( the_thread, pending_events, &seized_events )
>   ) {
> , I did see _Thread_Unblock called, but in _Thread_Clear_state 
> _Scheduler_Unblock was not called
> because the_thread->current_state = 0.
> do I have to set something else besides unblock=true to unblock my task ?

I am not sure if this is really the problem area indicated by the failed 
assertion in one of your previous e-mails:

assertion "first != _Chain_Tail( &ready_queues[ index ] )" failed: file 
line 166, function: _Scheduler_priority_Ready_queue_first

This assertion tells you that the scheduler data structures are corrupt. 
The thread wait flags are a different domain.

There are tests which specifically test the event send/receive conditions:


I would run at least these tests on your board. I normally run all tests 
during a BSP development.

Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the users mailing list