source: rtems/cpukit/score/src/thread.c @ a85d8ec

4.104.114.84.95
Last change on this file since a85d8ec was ef9505a9, checked in by Joel Sherrill <joel.sherrill@…>, on 07/01/02 at 22:30:12

2002-07-01 Joel Sherrill <joel@…>

  • Mega patch merge to change the format of the object IDs to loosen the dependency between the SCORE and the various APIs. There was considerable work to simplify the object name management and it appears that the name_table field is no longer needed. This patch also includes the addition of the internal mutex which is currently only used to protect some types of allocation and deallocation. This significantly can reduce context switch latency under certain circumstances. In particular, some heap/region operations were O(n) and had dispatching disabled. This should help enormously. With this merge, the patch is not as clean as it should be. In particular, the documentation has not been modified to reflect the new object ID layout, the IDs in the test screens are not updated, and _Objects_Get_information needs to be a real routine not inlined. As part of this patch a lot of MP code for thread/proxy blocking was made conditional and cleaned up.
  • include/Makefile.am, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/object.h, include/rtems/score/threadq.h, inline/rtems/score/object.inl, inline/rtems/score/thread.inl, macros/rtems/score/object.inl, src/Makefile.am, src/coremsg.c, src/coremutex.c, src/coresem.c, src/mpci.c, src/objectcomparenameraw.c, src/objectextendinformation.c, src/objectinitializeinformation.c, src/objectnametoid.c, src/thread.c, src/threadclose.c, src/threadget.c, src/threadq.c, src/threadqextractwithproxy.c: Modified as part of above.
  • include/rtems/score/apimutex.h, src/objectgetnoprotection.c: New files.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/apiext.h>
17#include <rtems/score/context.h>
18#include <rtems/score/interr.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/score/priority.h>
22#include <rtems/score/states.h>
23#include <rtems/score/sysstate.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/threadq.h>
26#include <rtems/score/userext.h>
27#include <rtems/score/wkspace.h>
28
29/*PAGE
30 *
31 *  _Thread_Handler_initialization
32 *
33 *  This routine initializes all thread manager related data structures.
34 *
35 *  Input parameters:
36 *    ticks_per_timeslice - clock ticks per quantum
37 *    maximum_proxies     - number of proxies to initialize
38 *
39 *  Output parameters:  NONE
40 */
41
42void _Thread_Handler_initialization(
43  unsigned32   ticks_per_timeslice,
44  unsigned32   maximum_extensions,
45  unsigned32   maximum_proxies
46)
47{
48  unsigned32      index;
49
50  /*
51   * BOTH stacks hooks must be set or both must be NULL.
52   * Do not allow mixture.
53   */
54
55  if ( !( ( _CPU_Table.stack_allocate_hook == 0 )
56       == ( _CPU_Table.stack_free_hook == 0 ) ) )
57    _Internal_error_Occurred(
58      INTERNAL_ERROR_CORE,
59      TRUE,
60      INTERNAL_ERROR_BAD_STACK_HOOK
61    );
62
63  _Context_Switch_necessary = FALSE;
64  _Thread_Executing         = NULL;
65  _Thread_Heir              = NULL;
66#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
67  _Thread_Allocated_fp      = NULL;
68#endif
69
70  _Thread_Do_post_task_switch_extension = 0;
71
72  _Thread_Maximum_extensions = maximum_extensions;
73
74  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
75
76  _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
77    (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
78  );
79
80  for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
81    _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
82
83#if defined(RTEMS_MULTIPROCESSING)
84  _Thread_MP_Handler_initialization( maximum_proxies );
85#endif
86
87  /*
88   *  Initialize this class of objects.
89   */
90 
91  _Objects_Initialize_information(
92    &_Thread_Internal_information,
93    OBJECTS_INTERNAL_API,
94    OBJECTS_INTERNAL_THREADS,
95    ( _System_state_Is_multiprocessing ) ?  2 : 1,
96    sizeof( Thread_Control ),
97                                /* size of this object's control block */
98    TRUE,                       /* TRUE if names for this object are strings */
99    8                           /* maximum length of each object's name */
100#if defined(RTEMS_MULTIPROCESSING)
101    ,
102    FALSE,                      /* TRUE if this is a global object class */
103    NULL                        /* Proxy extraction support callout */
104#endif
105  );
106
107}
108
Note: See TracBrowser for help on using the repository browser.