Synchronization problem in message queue mechanism

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Aug 22 14:52:14 UTC 2013


On 2013-08-22 15:23, Joel Sherrill wrote:
>> If I compare the functions _Event_Timeout() and _Thread_queue_Process_timeout()
>> I am a bit surprised that _Thread_queue_Process_timeout() doesn't use
>> _ISR_Disable/Enable() to protect the access to the_thread_queue->sync_state.
>> On a first glance this looks like a major bug.
> The assumption is that _Thread_queue_Process_timeout() is called from a clock tick
> ISR but thinking that doesn't prevent a nested interrupt from occurring.
>
> Does this system nest interrupts?

I think the problem occurs in case a nested interrupt hits 
_Thread_queue_Process_timeout().

It is quite hard to write a test case for this.  You need a thread that obtains 
a blocked semaphore with a finite timeout.  You need a second task that acts as 
a pseudo clock tick, that calls the timeout function after some a varying busy 
wait.  You need a timer that interrupts the pseudo clock tick task.

-- 
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