diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-12 14:25:50 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 07:49:36 +0200 |
commit | 270394eef82ae584477cb9c443d4a5c8e67978eb (patch) | |
tree | 7cb476c1212a917454a1650c751435381c6f0b0d | |
parent | score: Add _Thread_Exit() (diff) | |
download | rtems-270394eef82ae584477cb9c443d4a5c8e67978eb.tar.bz2 |
score: Avoid superfluous life protection
Disable thread dispatching is enough to prevent deletion of the
executing thread. There is no need for an additional life protection.
Update #2555.
Update #2626.
-rw-r--r-- | cpukit/posix/src/pthreadexit.c | 3 | ||||
-rw-r--r-- | cpukit/rtems/src/taskdelete.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/threadrestart.c | 3 |
3 files changed, 0 insertions, 12 deletions
diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c index 940fa381c1..559e37cc41 100644 --- a/cpukit/posix/src/pthreadexit.c +++ b/cpukit/posix/src/pthreadexit.c @@ -34,13 +34,11 @@ void _POSIX_Thread_Exit( Thread_Control *executing; Thread_Control *unblocked; POSIX_API_Control *api; - bool previous_life_protection; api = the_thread->API_Extensions[ THREAD_API_POSIX ]; _Assert( _Debug_Is_thread_dispatching_allowed() ); - previous_life_protection = _Thread_Set_life_protection( true ); _Thread_Disable_dispatch(); the_thread->Wait.return_argument = value_ptr; @@ -74,7 +72,6 @@ void _POSIX_Thread_Exit( } _Thread_Enable_dispatch(); - _Thread_Set_life_protection( previous_life_protection ); } void pthread_exit( diff --git a/cpukit/rtems/src/taskdelete.c b/cpukit/rtems/src/taskdelete.c index c0d46d8807..5830793688 100644 --- a/cpukit/rtems/src/taskdelete.c +++ b/cpukit/rtems/src/taskdelete.c @@ -30,9 +30,7 @@ rtems_status_code rtems_task_delete( Thread_Control *the_thread; Thread_Control *executing; Objects_Locations location; - bool previous_life_protection; - previous_life_protection = _Thread_Set_life_protection( true ); the_thread = _Thread_Get( id, &location ); switch ( location ) { @@ -60,13 +58,11 @@ rtems_status_code rtems_task_delete( } _Objects_Put( &the_thread->Object ); - _Thread_Set_life_protection( previous_life_protection ); return RTEMS_SUCCESSFUL; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: _Thread_Dispatch(); - _Thread_Set_life_protection( previous_life_protection ); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; #endif @@ -74,7 +70,5 @@ rtems_status_code rtems_task_delete( break; } - _Thread_Set_life_protection( previous_life_protection ); - return RTEMS_INVALID_ID; } diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index 0184fd1532..272fe7bb90 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -340,7 +340,6 @@ static void _Thread_Request_life_change( void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing ) { - _Assert( _Thread_Is_life_protected( executing->Life.state ) ); _Assert( the_thread != executing ); if ( _States_Is_dormant( the_thread->current_state ) ) { @@ -367,8 +366,6 @@ void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing ) void _Thread_Exit( Thread_Control *executing ) { - _Assert( _Thread_Is_life_protected( executing->Life.state ) ); - _Thread_Request_life_change( executing, executing, |