forked from Imagelibrary/rtems
@@ -19,37 +19,33 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <rtems/rtems/tasksimpl.h>
|
#include <rtems/rtems/tasksimpl.h>
|
||||||
#include <rtems/score/apimutex.h>
|
|
||||||
#include <rtems/score/threadimpl.h>
|
#include <rtems/score/threadimpl.h>
|
||||||
#include <rtems/config.h>
|
|
||||||
|
|
||||||
rtems_status_code rtems_task_delete(
|
rtems_status_code rtems_task_delete(
|
||||||
rtems_id id
|
rtems_id id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Thread_Control *the_thread;
|
Thread_Control *the_thread;
|
||||||
|
ISR_lock_Context lock_context;
|
||||||
Thread_Control *executing;
|
Thread_Control *executing;
|
||||||
Objects_Locations location;
|
Per_CPU_Control *cpu_self;
|
||||||
|
|
||||||
the_thread = _Thread_Get( id, &location );
|
the_thread = _Thread_Get_interrupt_disable( id, &lock_context );
|
||||||
switch ( location ) {
|
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
if ( the_thread == NULL ) {
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
if ( the_thread->is_global ) {
|
if ( _Thread_MP_Is_remote( id ) ) {
|
||||||
_Objects_MP_Close(
|
return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
|
||||||
&_RTEMS_tasks_Information.Objects,
|
|
||||||
the_thread->Object.id
|
|
||||||
);
|
|
||||||
_RTEMS_tasks_MP_Send_process_packet(
|
|
||||||
RTEMS_TASKS_MP_ANNOUNCE_DELETE,
|
|
||||||
the_thread->Object.id,
|
|
||||||
0 /* Not used */
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
executing = _Thread_Executing;
|
return RTEMS_INVALID_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
|
||||||
|
_ISR_lock_ISR_enable( &lock_context );
|
||||||
|
|
||||||
|
executing = _Per_CPU_Get_executing( cpu_self );
|
||||||
|
|
||||||
if ( the_thread == executing ) {
|
if ( the_thread == executing ) {
|
||||||
/*
|
/*
|
||||||
@@ -65,18 +61,6 @@ rtems_status_code rtems_task_delete(
|
|||||||
_Thread_Close( the_thread, executing );
|
_Thread_Close( the_thread, executing );
|
||||||
}
|
}
|
||||||
|
|
||||||
_Objects_Put( &the_thread->Object );
|
_Thread_Dispatch_enable( cpu_self );
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
case OBJECTS_REMOTE:
|
|
||||||
_Thread_Dispatch();
|
|
||||||
return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case OBJECTS_ERROR:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RTEMS_INVALID_ID;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,28 @@ static void _RTEMS_tasks_Start_extension(
|
|||||||
_Event_Initialize( &api->System_event );
|
_Event_Initialize( &api->System_event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
static void _RTEMS_tasks_Terminate_extension( Thread_Control *executing )
|
||||||
|
{
|
||||||
|
if ( executing->is_global ) {
|
||||||
|
_Objects_MP_Close(
|
||||||
|
&_RTEMS_tasks_Information.Objects,
|
||||||
|
executing->Object.id
|
||||||
|
);
|
||||||
|
_RTEMS_tasks_MP_Send_process_packet(
|
||||||
|
RTEMS_TASKS_MP_ANNOUNCE_DELETE,
|
||||||
|
executing->Object.id,
|
||||||
|
0 /* Not used */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
User_extensions_Control _RTEMS_tasks_User_extensions = {
|
User_extensions_Control _RTEMS_tasks_User_extensions = {
|
||||||
.Callouts = {
|
.Callouts = {
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
.thread_terminate = _RTEMS_tasks_Terminate_extension,
|
||||||
|
#endif
|
||||||
.thread_start = _RTEMS_tasks_Start_extension,
|
.thread_start = _RTEMS_tasks_Start_extension,
|
||||||
.thread_restart = _RTEMS_tasks_Start_extension
|
.thread_restart = _RTEMS_tasks_Start_extension
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user