source: rtems/cpukit/score/include/rtems/score/thread.h @ 6cd8bbe

4.104.114.95
Last change on this file since 6cd8bbe was 6cd8bbe, checked in by Joel Sherrill <joel.sherrill@…>, on 11/26/07 at 19:35:33

2007-11-26 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/thread.h: Fix spelling error.
  • Property mode set to 100644
File size: 25.7 KB
Line 
1/**
2 *  @file  rtems/score/thread.h
3 *
4 *  This include file contains all constants and structures associated
5 *  with the thread control block.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
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.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_THREAD_H
20#define _RTEMS_SCORE_THREAD_H
21
22/**
23 *  @defgroup ScoreThread Thread Handler
24 *
25 *  This handler encapsulates functionality related to the management of
26 *  threads.  This includes the creation, deletion, and scheduling of threads.
27 */
28/**@{*/
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/*
35 *  The user can define this at configure time and go back to ticks
36 *  resolution.
37 */
38#ifndef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__
39  /*
40   *  Enable the nanosecond accurate statistics
41   *
42   *  When not defined, the older style tick accurate granularity
43   *  is used.
44   */
45  #define RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
46#endif
47
48#include <rtems/score/context.h>
49#include <rtems/score/cpu.h>
50#if defined(RTEMS_MULTIPROCESSING)
51#include <rtems/score/mppkt.h>
52#endif
53#include <rtems/score/object.h>
54#include <rtems/score/priority.h>
55#include <rtems/score/stack.h>
56#include <rtems/score/states.h>
57#include <rtems/score/tod.h>
58#include <rtems/score/tqdata.h>
59#include <rtems/score/watchdog.h>
60
61#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
62  /* XXX include something for timespec */
63#endif
64
65/**
66 *  The following defines the "return type" of a thread.
67 *
68 *  @note  This cannot always be right.  Some APIs have void
69 *         tasks/threads, others return pointers, others may
70 *         return a numeric value.  Hopefully a pointer is
71 *         always at least as big as an uint32_t  . :)
72 */
73typedef void *Thread;
74
75/**
76 *  The following defines the ways in which the entry point for a
77 *  thread can be invoked.  Basically, it can be passed any
78 *  combination/permutation of a pointer and an uint32_t   value.
79 *
80 *  @note For now, we are ignoring the return type.
81 */
82typedef enum {
83  THREAD_START_NUMERIC,
84  THREAD_START_POINTER,
85  THREAD_START_BOTH_POINTER_FIRST,
86  THREAD_START_BOTH_NUMERIC_FIRST
87} Thread_Start_types;
88
89/** This type corresponds to a very simple style thread entry point. */
90typedef Thread ( *Thread_Entry )();   /* basic type */
91
92/** This type corresponds to a thread entry point which takes a single
93 *  unsigned thirty-two bit integer as an argument.
94 */
95typedef Thread ( *Thread_Entry_numeric )( uint32_t   );
96
97/** This type corresponds to a thread entry point which takes a single
98 *  untyped pointer as an argument.
99 */
100typedef Thread ( *Thread_Entry_pointer )( void * );
101
102/** This type corresponds to a thread entry point which takes a single
103 *  untyped pointer and an unsigned thirty-two bit integer as arguments.
104 */
105typedef Thread ( *Thread_Entry_both_pointer_first )( void *, uint32_t   );
106
107/** This type corresponds to a thread entry point which takes a single
108 *  unsigned thirty-two bit integer and an untyped pointer and an
109 *  as arguments.
110 */
111typedef Thread ( *Thread_Entry_both_numeric_first )( uint32_t  , void * );
112
113/**
114 *  The following lists the algorithms used to manage the thread cpu budget.
115 *
116 *  Reset Timeslice:   At each context switch, reset the time quantum.
117 *  Exhaust Timeslice: Only reset the quantum once it is consumed.
118 *  Callout:           Execute routine when budget is consumed.
119 */
120typedef enum {
121  THREAD_CPU_BUDGET_ALGORITHM_NONE,
122  THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE,
123  THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE,
124  THREAD_CPU_BUDGET_ALGORITHM_CALLOUT
125}  Thread_CPU_budget_algorithms;
126
127/** This type defines the Thread Control Block structure.
128 */
129typedef struct Thread_Control_struct Thread_Control;
130
131/**  This defines thes the entry point for the thread specific timeslice
132 *   budget management algorithm.
133 */
134typedef void (*Thread_CPU_budget_algorithm_callout )( Thread_Control * );
135
136/** @brief Per Task Variable Manager Structure Forward Reference
137 *
138 *  Forward reference to the per task variable structure.
139 */
140struct rtems_task_variable_tt;
141
142/** @brief Per Task Variable Manager Structure
143 *
144 *  This is the internal structure used to manager per Task Variables.
145 */
146typedef struct {
147  /** This field points to the next per task variable for this task. */
148  struct rtems_task_variable_tt  *next;
149  /** This field points to the physical memory location of this per
150   *  task variable.
151   */
152  void                          **ptr;
153  /** This field is to the global value for this per task variable. */
154  void                           *gval;
155  /** This field is to this thread's value for this per task variable. */
156  void                           *tval;
157  /** This field points to the destructor for this per task variable. */
158  void                          (*dtor)(void *);
159} rtems_task_variable_t;
160
161/**
162 *  The following structure contains the information which defines
163 *  the starting state of a thread.
164 */
165typedef struct {
166  /** This field is the starting address for the thread. */
167  Thread_Entry         entry_point;
168  /** This field indicates the how task is invoked. */
169  Thread_Start_types   prototype;
170  /** This field is the pointer argument passed at thread start. */
171  void                *pointer_argument;
172  /** This field is the numeric argument passed at thread start. */
173  uint32_t             numeric_argument;
174  /*-------------- initial execution modes ----------------- */
175  /** This field indicates whether the thread was preemptible when
176    * it started.
177    */
178  boolean              is_preemptible;
179  /** This field indicates the CPU budget algorith. */
180  Thread_CPU_budget_algorithms          budget_algorithm;
181  /** This field is the routine to invoke when the CPU allotment is
182   *  consumed.
183   */
184  Thread_CPU_budget_algorithm_callout   budget_callout;
185  /** This field is the initial ISR disable level of this thread. */
186  uint32_t             isr_level;
187  /** This field is the initial priority. */
188  Priority_Control     initial_priority;
189  /** This field indicates whether the SuperCore allocated the stack. */
190  boolean              core_allocated_stack;
191  /** This field is the stack information. */
192  Stack_Control        Initial_stack;
193#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
194  /** This field is the initial FP context area address. */
195  Context_Control_fp  *fp_context;
196#endif
197  /** This field is the initial stack area address. */
198  void                *stack;
199}   Thread_Start_information;
200
201/**
202 *  The following structure contains the information necessary to manage
203 *  a thread which it is  waiting for a resource.
204 */
205#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
206
207/** @brief Thread Blocking Management Information
208 *
209 *  This contains the information required to manage a thread while it is
210 *  blocked and to return information to it.
211 */
212typedef struct {
213  /** This field is the Id of the object this thread is waiting upon. */
214  Objects_Id            id;
215  /** This field is used to return an integer while when blocked. */
216  uint32_t              count;
217  /** This field is the first pointer to a user return argument. */
218  void                 *return_argument;
219  /** This field is the second pointer to a user return argument. */
220  void                 *return_argument_1;
221  /** This field contains any options in effect on this blocking operation. */
222  uint32_t              option;
223  /** This field will contain the return status from a blocking operation.
224   *
225   *  @note The following assumes that all API return codes can be
226   *        treated as an uint32_t.
227   */
228  uint32_t              return_code;
229
230  /** This field is the chain header for the second through Nth tasks
231   *  of the same priority blocked waiting on the same object.
232   */
233  Chain_Control         Block2n;
234  /** This field points to the thread queue on which this thread is blocked. */
235  Thread_queue_Control *queue;
236}   Thread_Wait_information;
237
238/**
239 *  The following defines the control block used to manage
240 *  each thread proxy.
241 *
242 *  @note It is critical that proxies and threads have identical
243 *        memory images for the shared part.
244 */
245typedef struct {
246  /** This field is the object management structure for each proxy. */
247  Objects_Control          Object;
248  /** This field is the current execution state of this proxy. */
249  States_Control           current_state;
250  /** This field is the current priority state of this proxy. */
251  Priority_Control         current_priority;
252  /** This field is the base priority of this proxy. */
253  Priority_Control         real_priority;
254  /** This field is the number of mutexes currently held by this proxy. */
255  uint32_t                 resource_count;
256  /** This field is the blocking information for this proxy. */
257  Thread_Wait_information  Wait;
258  /** This field is the Watchdog used to manage proxy delays and timeouts. */
259  Watchdog_Control         Timer;
260#if defined(RTEMS_MULTIPROCESSING)
261  /** This field is the received response packet in an MP system. */
262  MP_packet_Prefix        *receive_packet;
263#endif
264     /****************** end of common block ********************/
265  /** This field is used to manage the set of proxies in the system. */
266  Chain_Node               Active;
267}   Thread_Proxy_control;
268
269/**
270 *  The following record defines the control block used
271 *  to manage each thread.
272 *
273 *  @note It is critical that proxies and threads have identical
274 *        memory images for the shared part.
275 */
276typedef enum {
277  /** This value is for the Classic RTEMS API. */
278  THREAD_API_RTEMS,
279  /** This value is for the POSIX API. */
280  THREAD_API_POSIX,
281  /** This value is for the ITRON API. */
282  THREAD_API_ITRON
283}  Thread_APIs;
284
285/** This macro defines the first API which has threads. */
286#define THREAD_API_FIRST THREAD_API_RTEMS
287
288/** This macro defines the last API which has threads. */
289#define THREAD_API_LAST  THREAD_API_ITRON
290
291/**
292 *  This structure defines the Thread Control Block (TCB).
293 */
294struct Thread_Control_struct {
295  /** This field is the object management structure for each thread. */
296  Objects_Control          Object;
297  /** This field is the current execution state of this thread. */
298  States_Control           current_state;
299  /** This field is the current priority state of this thread. */
300  Priority_Control         current_priority;
301  /** This field is the base priority of this thread. */
302  Priority_Control         real_priority;
303  /** This field is the number of mutexes currently held by this thread. */
304  uint32_t                 resource_count;
305  /** This field is the blocking information for this thread. */
306  Thread_Wait_information  Wait;
307  /** This field is the Watchdog used to manage thread delays and timeouts. */
308  Watchdog_Control         Timer;
309#if defined(RTEMS_MULTIPROCESSING)
310  /** This field is the received response packet in an MP system. */
311  MP_packet_Prefix        *receive_packet;
312#endif
313     /*================= end of common block =================*/
314  /** This field is the number of nested suspend calls. */
315  uint32_t                              suspend_count;
316  /** This field is true if the thread is offered globally */
317  boolean                               is_global;
318  /** This field is is true if the post task context switch should be
319   *  executed for this thread at the next context switch.
320   */
321  boolean                               do_post_task_switch_extension;
322  /** This field is true if the thread is preemptible. */
323  boolean                               is_preemptible;
324  /** This field is the GNAT self context pointer. */
325  void                                 *rtems_ada_self;
326  /** This field is the length of the time quantum that this thread is
327   *  allowed to consume.  The algorithm used to manage limits on CPU usage
328   *  is specified by budget_algorithm.
329   */
330  uint32_t                              cpu_time_budget;
331  /** This field is the algorithm used to manage this thread's time
332   *  quantum.  The algorithm may be specified as none which case,
333   *  no limit is in place.
334   */
335  Thread_CPU_budget_algorithms          budget_algorithm;
336  /** This field is the method invoked with the budgeted time is consumed. */
337  Thread_CPU_budget_algorithm_callout   budget_callout;
338
339  /** This field is the amount of CPU time consumed by this thread
340   *  since it was created.
341   */
342  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
343    struct timespec                       cpu_time_used;
344  #else
345    uint32_t                              ticks_executed;
346  #endif
347  /** This field points to the Ready FIFO for this priority. */
348  Chain_Control                        *ready;
349  /** This field contains precalculated priority map indices. */
350  Priority_Information                  Priority_map;
351  /** This field contains information about the starting state of
352   *  this thread.
353   */
354  Thread_Start_information              Start;
355  /** This field contains the context of this thread. */
356  Context_Control                       Registers;
357#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
358  /** This field points to the floating point context for this thread.
359   *  If NULL, the thread is integer only.
360   */
361  Context_Control_fp                   *fp_context;
362#endif
363  /** This field points to the newlib reentrancy structure for this thread. */
364  struct _reent                        *libc_reent;
365  /** This array contains the API extension area pointers. */
366  void                                 *API_Extensions[ THREAD_API_LAST + 1 ];
367  /** This field points to the user extension pointers. */
368  void                                **extensions;
369  /** This field points to the set of per task variables. */
370  rtems_task_variable_t                *task_variables;
371};
372
373/**
374 *  Self for the GNU Ada Run-Time
375 */
376SCORE_EXTERN void *rtems_ada_self;
377
378/**
379 *  The following defines the information control block used to
380 *  manage this class of objects.
381 */
382SCORE_EXTERN Objects_Information _Thread_Internal_information;
383
384/**
385 *  The following define the thread control pointers used to access
386 *  and manipulate the idle thread.
387 */
388SCORE_EXTERN Thread_Control *_Thread_Idle;
389
390/**
391 *  The following context area contains the context of the "thread"
392 *  which invoked the start multitasking routine.  This context is
393 *  restored as the last action of the stop multitasking routine.  Thus
394 *  control of the processor can be returned to the environment
395 *  which initiated the system.
396 */
397SCORE_EXTERN Context_Control _Thread_BSP_context;
398
399/**
400 *  The following declares the dispatch critical section nesting
401 *  counter which is used to prevent context switches at inopportune
402 *  moments.
403 */
404SCORE_EXTERN volatile uint32_t   _Thread_Dispatch_disable_level;
405
406/**
407 *  If this is non-zero, then the post-task switch extension
408 *  is run regardless of the state of the per thread flag.
409 */
410SCORE_EXTERN uint32_t   _Thread_Do_post_task_switch_extension;
411
412/**
413 *  The following holds how many user extensions are in the system.  This
414 *  is used to determine how many user extension data areas to allocate
415 *  per thread.
416 */
417SCORE_EXTERN uint32_t   _Thread_Maximum_extensions;
418
419/**
420 *  The following is used to manage the length of a timeslice quantum.
421 */
422SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
423
424/**
425 *  The following points to the array of FIFOs used to manage the
426 *  set of ready threads.
427 */
428SCORE_EXTERN Chain_Control *_Thread_Ready_chain;
429
430/**
431 *  The following points to the thread which is currently executing.
432 *  This thread is implicitly manipulated by numerous directives.
433 */
434SCORE_EXTERN Thread_Control *_Thread_Executing;
435
436/**
437 *  The following points to the highest priority ready thread
438 *  in the system.  Unless the current thread is not preemptibl,
439 *  then this thread will be context switched to when the next
440 *  dispatch occurs.
441 */
442SCORE_EXTERN Thread_Control *_Thread_Heir;
443
444/**
445 *  The following points to the thread whose floating point
446 *  context is currently loaded.
447 */
448#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
449SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
450#endif
451
452/**
453 * The C library re-enter-rant global pointer. Some C library implementations
454 * such as newlib have a single global pointer that changed during a context
455 * switch. The pointer points to that global pointer. The Thread control block
456 * holds a pointer to the task specific data.
457 */
458SCORE_EXTERN struct _reent **_Thread_libc_reent;
459
460#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
461
462  /**
463   * This contains the time since boot when the last context switch occurred.
464   * By placing it in the BSS, it will automatically be zeroed out at
465   * system initialization and does not need to be known outside this
466   * file.
467   */
468  SCORE_EXTERN struct timespec _Thread_Time_of_last_context_switch;
469#endif
470
471/**
472 *  This routine performs the initialization necessary for this handler.
473 */
474void _Thread_Handler_initialization (
475  uint32_t     ticks_per_timeslice,
476  uint32_t     maximum_extensions,
477  uint32_t     maximum_proxies
478);
479
480/**
481 *  This routine creates the idle thread.
482 *
483 *  @warning No thread should be created before this one.
484 */
485void _Thread_Create_idle( void );
486
487/**
488 *  This routine initiates multitasking.  It is invoked only as
489 *  part of initialization and its invocation is the last act of
490 *  the non-multitasking part of the system initialization.
491 */
492void _Thread_Start_multitasking( void );
493
494/**
495 *  This routine is responsible for transferring control of the
496 *  processor from the executing thread to the heir thread.  As part
497 *  of this process, it is responsible for the following actions:
498 *
499 *     + saving the context of the executing thread
500 *     + restoring the context of the heir thread
501 *     + dispatching any signals for the resulting executing thread
502 */
503void _Thread_Dispatch( void );
504
505/**
506 *  Allocate the requested stack space for the thread.
507 *  return the actual size allocated after any adjustment
508 *  or return zero if the allocation failed.
509 *  Set the Start.stack field to the address of the stack
510 */
511
512size_t _Thread_Stack_Allocate(
513  Thread_Control *the_thread,
514  size_t          stack_size
515);
516
517/**
518 *  Deallocate the Thread's stack.
519 */
520void _Thread_Stack_Free(
521  Thread_Control *the_thread
522);
523
524/**
525 *  This routine initializes the specified the thread.  It allocates
526 *  all memory associated with this thread.  It completes by adding
527 *  the thread to the local object table so operations on this
528 *  thread id are allowed.
529 *
530 *  @note If stack_area is NULL, it is allocated from the workspace.
531 *
532 *  @note If the stack is allocated from the workspace, then it is
533 *        guaranteed to be of at least minimum size.
534 */
535boolean _Thread_Initialize(
536  Objects_Information                  *information,
537  Thread_Control                       *the_thread,
538  void                                 *stack_area,
539  size_t                                stack_size,
540  boolean                               is_fp,
541  Priority_Control                      priority,
542  boolean                               is_preemptible,
543  Thread_CPU_budget_algorithms          budget_algorithm,
544  Thread_CPU_budget_algorithm_callout   budget_callout,
545  uint32_t                              isr_level,
546  Objects_Name                          name
547);
548
549/**
550 *  This routine initializes the executable information for a thread
551 *  and makes it ready to execute.  After this routine executes, the
552 *  thread competes with all other threads for CPU time.
553 */
554boolean _Thread_Start(
555  Thread_Control           *the_thread,
556  Thread_Start_types        the_prototype,
557  void                     *entry_point,
558  void                     *pointer_argument,
559  uint32_t                  numeric_argument
560);
561
562/**
563 *  This support routine restarts the specified task in a way that the
564 *  next time this thread executes, it will begin execution at its
565 *  original starting point.
566 *
567 *  TODO:  multiple task arg profiles
568 */
569boolean _Thread_Restart(
570  Thread_Control           *the_thread,
571  void                     *pointer_argument,
572  uint32_t                  numeric_argument
573);
574
575/**
576 *  This routine resets a thread to its initial state but does
577 *  not restart it.
578 */
579void _Thread_Reset(
580  Thread_Control      *the_thread,
581  void                *pointer_argument,
582  uint32_t             numeric_argument
583);
584
585/**
586 *  This routine frees all memory associated with the specified
587 *  thread and removes it from the local object table so no further
588 *  operations on this thread are allowed.
589 */
590void _Thread_Close(
591  Objects_Information  *information,
592  Thread_Control       *the_thread
593);
594
595/**
596 *  This routine removes any set states for the_thread.  It performs
597 *  any necessary scheduling operations including the selection of
598 *  a new heir thread.
599 */
600void _Thread_Ready(
601  Thread_Control *the_thread
602);
603
604/**
605 *  This routine clears the indicated STATES for the_thread.  It performs
606 *  any necessary scheduling operations including the selection of
607 *  a new heir thread.
608 */
609void _Thread_Clear_state(
610  Thread_Control *the_thread,
611  States_Control  state
612);
613
614/**
615 *  This routine sets the indicated states for the_thread.  It performs
616 *  any necessary scheduling operations including the selection of
617 *  a new heir thread.
618 */
619void _Thread_Set_state(
620  Thread_Control *the_thread,
621  States_Control  state
622);
623
624/**
625 *  This routine sets the TRANSIENT state for the_thread.  It performs
626 *  any necessary scheduling operations including the selection of
627 *  a new heir thread.
628 */
629void _Thread_Set_transient(
630  Thread_Control *the_thread
631);
632
633/**
634 *  This routine is invoked upon expiration of the currently
635 *  executing thread's timeslice.  If no other thread's are ready
636 *  at the priority of the currently executing thread, then the
637 *  executing thread's timeslice is reset.  Otherwise, the
638 *  currently executing thread is placed at the rear of the
639 *  FIFO for this priority and a new heir is selected.
640 */
641void _Thread_Reset_timeslice( void );
642
643/**
644 *  This routine is invoked as part of processing each clock tick.
645 *  It is responsible for determining if the current thread allows
646 *  timeslicing and, if so, when its timeslice expires.
647 */
648void _Thread_Tickle_timeslice( void );
649
650/**
651 *  This routine is invoked when a thread wishes to voluntarily
652 *  transfer control of the processor to another thread of equal
653 *  or greater priority.
654 */
655void _Thread_Yield_processor( void );
656
657/**
658 *  This routine is invoked to rotate the ready queue for the
659 *  given priority.  It can be used to yeild the processor
660 *  by rotating the executing threads ready queue.
661 */
662void _Thread_Rotate_Ready_Queue(
663  Priority_Control  priority
664);
665
666/**
667 *  This routine initializes the context of the_thread to its
668 *  appropriate starting state.
669 */
670void _Thread_Load_environment(
671  Thread_Control *the_thread
672);
673
674/**
675 *  This routine is the wrapper function for all threads.  It is
676 *  the starting point for all threads.  The user provided thread
677 *  entry point is invoked by this routine.  Operations
678 *  which must be performed immediately before and after the user's
679 *  thread executes are found here.
680 */
681void _Thread_Handler( void );
682
683/**
684 *  This routine is invoked when a thread must be unblocked at the
685 *  end of a time based delay (i.e. wake after or wake when).
686 */
687void _Thread_Delay_ended(
688  Objects_Id  id,
689  void       *ignored
690);
691
692/**
693 *  This routine changes the current priority of the_thread to
694 *  new_priority.  It performs any necessary scheduling operations
695 *  including the selection of a new heir thread.
696 */
697void _Thread_Change_priority (
698  Thread_Control   *the_thread,
699  Priority_Control  new_priority,
700  boolean           prepend_it
701);
702
703/**
704 *  This routine updates the priority related fields in the_thread
705 *  control block to indicate the current priority is now new_priority.
706 */
707void _Thread_Set_priority(
708  Thread_Control   *the_thread,
709  Priority_Control  new_priority
710);
711
712/**
713 *  This routine updates the related suspend fields in the_thread
714 *  control block to indicate the current nested level.
715 */
716void _Thread_Suspend(
717  Thread_Control   *the_thread
718);
719
720/**
721 *  This routine updates the related suspend fields in the_thread
722 *  control block to indicate the current nested level.  A force
723 *  parameter of TRUE will force a resume and clear the suspend count.
724 */
725void _Thread_Resume(
726  Thread_Control   *the_thread,
727  boolean           force
728);
729
730/**
731 *  This routine evaluates the current scheduling information for the
732 *  system and determines if a context switch is required.  This
733 *  is usually called after changing an execution mode such as preemptability
734 *  for a thread.
735 */
736boolean _Thread_Evaluate_mode( void );
737
738#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
739/**
740 *  This routine is the body of the system idle thread.
741 */
742Thread _Thread_Idle_body(
743  uint32_t   ignored
744);
745#endif
746
747/**  This defines the type for a method which operates on a single thread.
748 */
749typedef void (*rtems_per_thread_routine)( Thread_Control * );
750
751/**
752 *  This routine iterates over all threads regardless of API and
753 *  invokes the specified routine.
754 */
755void rtems_iterate_over_all_threads(
756  rtems_per_thread_routine routine
757);
758
759/**
760 *  This function maps thread IDs to thread control
761 *  blocks.  If ID corresponds to a local thread, then it
762 *  returns the_thread control pointer which maps to ID
763 *  and location is set to OBJECTS_LOCAL.  If the thread ID is
764 *  global and resides on a remote node, then location is set
765 *  to OBJECTS_REMOTE, and the_thread is undefined.
766 *  Otherwise, location is set to OBJECTS_ERROR and
767 *  the_thread is undefined.
768 *
769 *  @note  The performance of many RTEMS services depends upon
770 *         the quick execution of the "good object" path in this
771 *         routine.  If there is a possibility of saving a few
772 *         cycles off the execution time, this routine is worth
773 *         further optimization attention.
774 */
775Thread_Control *_Thread_Get (
776  Objects_Id         id,
777  Objects_Locations *location
778);
779
780#ifndef __RTEMS_APPLICATION__
781#include <rtems/score/thread.inl>
782#endif
783#if defined(RTEMS_MULTIPROCESSING)
784#include <rtems/score/threadmp.h>
785#endif
786
787#ifdef __cplusplus
788}
789#endif
790
791/**@}*/
792
793#endif
794/* end of include file */
Note: See TracBrowser for help on using the repository browser.