source: rtems/cpukit/rtems/src/tasks.c @ 66cb142

5
Last change on this file since 66cb142 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
RevLine 
[52adc808]1/**
2 *  @file
[ac7d5ef0]3 *
[52adc808]4 *  @brief RTEMS Task API Extensions
5 *  @ingroup ClassicTasks
6 */
7
8/*
[e6c87f7]9 *  COPYRIGHT (c) 1989-2014.
[ac7d5ef0]10 *  On-Line Applications Research Corporation (OAR).
11 *
[98e4ebf5]12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
[c499856]14 *  http://www.rtems.org/license/LICENSE.
[ac7d5ef0]15 */
16
[1095ec1]17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
[4cb19041]21#include <rtems/config.h>
[565672a]22#include <rtems/sysinit.h>
[e151eb1]23#include <rtems/rtems/eventimpl.h>
[c404828]24#include <rtems/rtems/tasksimpl.h>
[6fd1bdb7]25#include <rtems/score/threadimpl.h>
[3be0c9a]26#include <rtems/score/userextimpl.h>
[3a4ae6c]27
[565672a]28Thread_Information _RTEMS_tasks_Information;
29
[32a19d6]30static void _RTEMS_tasks_Start_extension(
[3a4ae6c]31  Thread_Control *executing,
32  Thread_Control *started
33)
34{
35  RTEMS_API_Control *api;
36
37  api = started->API_Extensions[ THREAD_API_RTEMS ];
[50f32b11]38
[990575c]39  _Event_Initialize( &api->Event );
[0edf263]40  _Event_Initialize( &api->System_event );
[3a4ae6c]41}
42
[f36ada32]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
[7af35da5]60User_extensions_Control _RTEMS_tasks_User_extensions = {
[1d40d81b]61  .Callouts = {
[f36ada32]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
[3a4ae6c]67  }
68};
[ac7d5ef0]69
[565672a]70static void _RTEMS_tasks_Manager_initialization(void)
[5250ff39]71{
[d7665823]72  _Thread_Initialize_information(
[90015e7f]73    &_RTEMS_tasks_Information, /* object information table */
74    OBJECTS_CLASSIC_API,       /* object API */
75    OBJECTS_RTEMS_TASKS,       /* object class */
[db80f11]76    Configuration_RTEMS_API.maximum_tasks,
77                               /* maximum objects of this class */
[eaef4657]78    false,                     /* true if the name is a string */
[90015e7f]79    RTEMS_MAXIMUM_NAME_LENGTH  /* maximum length of an object name */
[5250ff39]80  );
[3a4ae6c]81
82  /*
83   *  Add all the extensions for this API
84   */
85
[7af35da5]86  _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions );
[3a4ae6c]87
88  /*
89   *  Register the MP Process Packet routine.
90   */
91
[97e2729d]92#if defined(RTEMS_MULTIPROCESSING)
[3a4ae6c]93  _MPCI_Register_packet_processor(
94    MP_PACKET_TASKS,
95    _RTEMS_tasks_MP_Process_packet
96  );
[97e2729d]97#endif
[3a4ae6c]98
[5250ff39]99}
[0ab34c90]100
[565672a]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.