From da82656065d09f7b6aa411ba361287afdd787204 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 13 May 2016 10:28:14 +0200 Subject: posix: Rework thread cancellation Add Thread_Life_state::THREAD_LIFE_CHANGE_DEFERRED and rework the POSIX thread cancellation to use the thread life states. Update #2555. Update #2626. --- cpukit/posix/src/pthreadexit.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'cpukit/posix/src/pthreadexit.c') diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c index 3c4d3ebaaf..53c42ff3d0 100644 --- a/cpukit/posix/src/pthreadexit.c +++ b/cpukit/posix/src/pthreadexit.c @@ -9,6 +9,8 @@ * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * + * Copyright (c) 2016 embedded brains GmbH. + * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. @@ -20,41 +22,18 @@ #include -#include -#include -#include #include -#include -void _POSIX_Thread_Exit( - Thread_Control *the_thread, - void *value_ptr -) +void pthread_exit( void *value_ptr ) { Thread_Control *executing; Per_CPU_Control *cpu_self; - _Assert( _Debug_Is_thread_dispatching_allowed() ); - cpu_self = _Thread_Dispatch_disable(); executing = _Per_CPU_Get_executing( cpu_self ); - /* - * Now shut down the thread - */ - if ( the_thread == executing ) { - _Thread_Exit( executing, THREAD_LIFE_TERMINATING, value_ptr ); - } else { - _Thread_Cancel( the_thread, executing, value_ptr ); - } + _Thread_Exit( executing, THREAD_LIFE_TERMINATING, value_ptr ); _Thread_Dispatch_enable( cpu_self ); -} - -void pthread_exit( - void *value_ptr -) -{ - _POSIX_Thread_Exit( _Thread_Get_executing(), value_ptr ); RTEMS_UNREACHABLE(); } -- cgit v1.2.3