diff options
Diffstat (limited to 'c/src/exec/itron/src/ter_tsk.c')
-rw-r--r-- | c/src/exec/itron/src/ter_tsk.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/c/src/exec/itron/src/ter_tsk.c b/c/src/exec/itron/src/ter_tsk.c index c0d05c1fec..070cfcee25 100644 --- a/c/src/exec/itron/src/ter_tsk.c +++ b/c/src/exec/itron/src/ter_tsk.c @@ -18,13 +18,37 @@ /* - * ter_tsk - Terminate Other Task + * ter_tsk - Terminate Other Task - Set State to DORMANT */ ER ter_tsk( ID tskid ) { + register Thread_Control *the_thread; + Objects_Locations location; + + the_thread = _ITRON_Task_Get( tskid, &location ); + + if ( !the_thread ) + _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) ); + + if ( the_thread == _Thread_Executing ) + _ITRON_return_errorno( E_OBJ ); + + if ( _States_Is_dormant( the_thread->current_state ) ) + _ITRON_return_errorno( E_OBJ ); + + _Thread_Restart( the_thread, NULL, 0 ); + _Thread_Set_state( the_thread, STATES_DORMANT ); + + _Thread_Enable_dispatch(); return E_OK; } + + + + + + |