source: rtems/cpukit/rtems/src/tasks.c @ 57c676c6

5
Last change on this file since 57c676c6 was f36ada32, checked in by Sebastian Huber <sebastian.huber@…>, on 05/17/16 at 12:38:57

rtems: Avoid Giant lock for rtems_task_delete()

Update #2555.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Task API Extensions
5 *  @ingroup ClassicTasks
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/config.h>
22#include <rtems/sysinit.h>
23#include <rtems/rtems/eventimpl.h>
24#include <rtems/rtems/tasksimpl.h>
25#include <rtems/score/threadimpl.h>
26#include <rtems/score/userextimpl.h>
27
28Thread_Information _RTEMS_tasks_Information;
29
30static void _RTEMS_tasks_Start_extension(
31  Thread_Control *executing,
32  Thread_Control *started
33)
34{
35  RTEMS_API_Control *api;
36
37  api = started->API_Extensions[ THREAD_API_RTEMS ];
38
39  _Event_Initialize( &api->Event );
40  _Event_Initialize( &api->System_event );
41}
42
43#if defined(RTEMS_MULTIPROCESSING)
44static void _RTEMS_tasks_Terminate_extension( Thread_Control *executing )
45{
46  if ( executing->is_global ) {
47    _Objects_MP_Close(
48      &_RTEMS_tasks_Information.Objects,
49      executing->Object.id
50    );
51    _RTEMS_tasks_MP_Send_process_packet(
52      RTEMS_TASKS_MP_ANNOUNCE_DELETE,
53      executing->Object.id,
54      0                                /* Not used */
55    );
56  }
57}
58#endif
59
60User_extensions_Control _RTEMS_tasks_User_extensions = {
61  .Callouts = {
62#if defined(RTEMS_MULTIPROCESSING)
63    .thread_terminate = _RTEMS_tasks_Terminate_extension,
64#endif
65    .thread_start     = _RTEMS_tasks_Start_extension,
66    .thread_restart   = _RTEMS_tasks_Start_extension
67  }
68};
69
70static void _RTEMS_tasks_Manager_initialization(void)
71{
72  _Thread_Initialize_information(
73    &_RTEMS_tasks_Information, /* object information table */
74    OBJECTS_CLASSIC_API,       /* object API */
75    OBJECTS_RTEMS_TASKS,       /* object class */
76    Configuration_RTEMS_API.maximum_tasks,
77                               /* maximum objects of this class */
78    false,                     /* true if the name is a string */
79    RTEMS_MAXIMUM_NAME_LENGTH  /* maximum length of an object name */
80  );
81
82  /*
83   *  Add all the extensions for this API
84   */
85
86  _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions );
87
88  /*
89   *  Register the MP Process Packet routine.
90   */
91
92#if defined(RTEMS_MULTIPROCESSING)
93  _MPCI_Register_packet_processor(
94    MP_PACKET_TASKS,
95    _RTEMS_tasks_MP_Process_packet
96  );
97#endif
98
99}
100
101RTEMS_SYSINIT_ITEM(
102  _RTEMS_tasks_Manager_initialization,
103  RTEMS_SYSINIT_CLASSIC_TASKS,
104  RTEMS_SYSINIT_ORDER_MIDDLE
105);
Note: See TracBrowser for help on using the repository browser.