source: rtems/cpukit/score/src/thread.c @ 05df0a8

4.104.114.84.95
Last change on this file since 05df0a8 was 05df0a8, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 20:41:13

Thread Handler split into multiple files. Eventually, as RTEMS is
split into one function per file, this will decrease the size of executables.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/score/apiext.h>
18#include <rtems/score/context.h>
19#include <rtems/score/interr.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/object.h>
22#include <rtems/score/priority.h>
23#include <rtems/score/states.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27#include <rtems/score/userext.h>
28#include <rtems/score/wkspace.h>
29
30/*PAGE
31 *
32 *  _Thread_Handler_initialization
33 *
34 *  This routine initializes all thread manager related data structures.
35 *
36 *  Input parameters:
37 *    ticks_per_timeslice - clock ticks per quantum
38 *    maximum_proxies     - number of proxies to initialize
39 *
40 *  Output parameters:  NONE
41 */
42
43void _Thread_Handler_initialization(
44  unsigned32   ticks_per_timeslice,
45  unsigned32   maximum_extensions,
46  unsigned32   maximum_proxies
47)
48{
49  unsigned32      index;
50
51  /*
52   * BOTH stacks hooks must be set or both must be NULL.
53   * Do not allow mixture.
54   */
55
56  if ( !( ( _CPU_Table.stack_allocate_hook == 0 )
57       == ( _CPU_Table.stack_free_hook == 0 ) ) )
58    _Internal_error_Occurred(
59      INTERNAL_ERROR_CORE,
60      TRUE,
61      INTERNAL_ERROR_BAD_STACK_HOOK
62    );
63
64  _Context_Switch_necessary = FALSE;
65  _Thread_Executing         = NULL;
66  _Thread_Heir              = NULL;
67  _Thread_Allocated_fp      = NULL;
68
69  _Thread_Do_post_task_switch_extension = 0;
70
71  _Thread_Maximum_extensions = maximum_extensions;
72
73  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
74
75  _Thread_Ready_chain = (Chain_Control *) _Workspace_Allocate_or_fatal_error(
76    (PRIORITY_MAXIMUM + 1) * sizeof(Chain_Control)
77  );
78
79  for ( index=0; index <= PRIORITY_MAXIMUM ; index++ )
80    _Chain_Initialize_empty( &_Thread_Ready_chain[ index ] );
81
82#if defined(RTEMS_MULTIPROCESSING)
83  _Thread_MP_Handler_initialization( maximum_proxies );
84#endif
85
86  /*
87   *  Initialize this class of objects.
88   */
89 
90  _Objects_Initialize_information(
91    &_Thread_Internal_information,
92    OBJECTS_INTERNAL_THREADS,
93    FALSE,
94    ( _System_state_Is_multiprocessing ) ?  2 : 1,
95    sizeof( Thread_Control ),
96    TRUE,
97    8,
98    TRUE
99  );
100
101}
102
Note: See TracBrowser for help on using the repository browser.