From f6b7b7ba0ae31a7e0f4aace3ebec03e0623d2e40 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 18 Jun 2014 12:11:04 +0200 Subject: score: Fix _Thread_Delay_ended() on SMP Suppose we have two tasks A and B and two processors. Task A is about to delete task B. Now task B calls rtems_task_wake_after(1) on the other processor. Task B will block on the Giant lock. Task A progresses with the task B deletion until it has to wait for termination. Now task B obtains the Giant lock, sets its state to STATES_DELAYING, initializes its watchdog timer and waits. Eventually _Thread_Delay_ended() is called, but now _Thread_Get() returned NULL since the thread is already marked as deleted. Thus task B remained forever in the STATES_DELAYING state. Instead of passing the thread identifier use the thread control block directly via the watchdog user argument. This makes _Thread_Delay_ended() also a bit more efficient. --- cpukit/posix/src/nanosleep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cpukit/posix/src') diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c index 54902b9c75..1fbeaa3df4 100644 --- a/cpukit/posix/src/nanosleep.c +++ b/cpukit/posix/src/nanosleep.c @@ -85,8 +85,8 @@ int nanosleep( _Watchdog_Initialize( &executing->Timer, _Thread_Delay_ended, - executing->Object.id, - NULL + 0, + executing ); _Watchdog_Insert_ticks( &executing->Timer, ticks ); _Thread_Enable_dispatch(); -- cgit v1.2.3