From d78d5294cd076b48160e12c2f52a940d783b4dac Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 14 Nov 2016 09:11:07 +0100 Subject: score: Add and use _Thread_Dispatch_direct() This function is useful for operations which synchronously block, e.g. self restart, self deletion, yield, sleep. It helps to detect if these operations are called in the wrong context. Since the thread dispatch necessary indicator is not used, this is more robust in some SMP situations. Update #2751. --- cpukit/score/src/threaddispatch.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cpukit/score/src/threaddispatch.c') diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c index 36d2910ef2..c96299cb59 100644 --- a/cpukit/score/src/threaddispatch.c +++ b/cpukit/score/src/threaddispatch.c @@ -233,3 +233,19 @@ void _Thread_Dispatch( void ) _ISR_Local_enable( level ); } } + +void _Thread_Dispatch_direct( Per_CPU_Control *cpu_self ) +{ + ISR_Level level; + + if ( cpu_self->thread_dispatch_disable_level != 1 ) { + _Terminate( + INTERNAL_ERROR_CORE, + 0, + INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL + ); + } + + _ISR_Local_disable( level ); + _Thread_Do_dispatch( cpu_self, level ); +} -- cgit v1.2.3