source: rtems/cpukit/score/include/rtems/score/thread.h @ fd84982

4.104.114.95
Last change on this file since fd84982 was fd84982, checked in by Joel Sherrill <joel.sherrill@…>, on 12/21/07 at 15:50:09

2007-12-21 Xi Yang <hiyangxi@…>

  • configure.ac, score/include/rtems/score/coremutex.h, score/include/rtems/score/thread.h, score/inline/rtems/score/coremutex.inl, score/src/coremutexsurrender.c, score/src/threadinitialize.c: Add support for proper stacking of priority inheritance on mutexes as well as enforce proper order of release.
  • Property mode set to 100644
File size: 25.9 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-2007.
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
257  /** This field is the blocking information for this proxy. */
258  Thread_Wait_information  Wait;
259  /** This field is the Watchdog used to manage proxy delays and timeouts. */
260  Watchdog_Control         Timer;
261#if defined(RTEMS_MULTIPROCESSING)
262  /** This field is the received response packet in an MP system. */
263  MP_packet_Prefix        *receive_packet;
264#endif
265     /****************** end of common block ********************/
266  /** This field is used to manage the set of proxies in the system. */
267  Chain_Node               Active;
268}   Thread_Proxy_control;
269
270/**
271 *  The following record defines the control block used
272 *  to manage each thread.
273 *
274 *  @note It is critical that proxies and threads have identical
275 *        memory images for the shared part.
276 */
277typedef enum {
278  /** This value is for the Classic RTEMS API. */
279  THREAD_API_RTEMS,
280  /** This value is for the POSIX API. */
281  THREAD_API_POSIX,
282  /** This value is for the ITRON API. */
283  THREAD_API_ITRON
284}  Thread_APIs;
285
286/** This macro defines the first API which has threads. */
287#define THREAD_API_FIRST THREAD_API_RTEMS
288
289/** This macro defines the last API which has threads. */
290#define THREAD_API_LAST  THREAD_API_ITRON
291
292/**
293 *  This structure defines the Thread Control Block (TCB).
294 */
295struct Thread_Control_struct {
296  /** This field is the object management structure for each thread. */
297  Objects_Control          Object;
298  /** This field is the current execution state of this thread. */
299  States_Control           current_state;
300  /** This field is the current priority state of this thread. */
301  Priority_Control         current_priority;
302  /** This field is the base priority of this thread. */
303  Priority_Control         real_priority;
304  /** This field is the number of mutexes currently held by this thread. */
305  uint32_t                 resource_count;
306  /** This field is the blocking information for this thread. */
307  Thread_Wait_information  Wait;
308  /** This field is the Watchdog used to manage thread delays and timeouts. */
309  Watchdog_Control         Timer;
310#if defined(RTEMS_MULTIPROCESSING)
311  /** This field is the received response packet in an MP system. */
312  MP_packet_Prefix        *receive_packet;
313#endif
314#ifdef __STRICT_ORDER_MUTEX__
315  /**This field is the head of queue of priority inheritance mutex holed by the thread*/
316  Chain_Control            lock_mutex;
317#endif
318     /*================= end of common block =================*/
319  /** This field is the number of nested suspend calls. */
320  uint32_t                              suspend_count;
321  /** This field is true if the thread is offered globally */
322  boolean                               is_global;
323  /** This field is is true if the post task context switch should be
324   *  executed for this thread at the next context switch.
325   */
326  boolean                               do_post_task_switch_extension;
327  /** This field is true if the thread is preemptible. */
328  boolean                               is_preemptible;
329  /** This field is the GNAT self context pointer. */
330  void                                 *rtems_ada_self;
331  /** This field is the length of the time quantum that this thread is
332   *  allowed to consume.  The algorithm used to manage limits on CPU usage
333   *  is specified by budget_algorithm.
334   */
335  uint32_t                              cpu_time_budget;
336  /** This field is the algorithm used to manage this thread's time
337   *  quantum.  The algorithm may be specified as none which case,
338   *  no limit is in place.
339   */
340  Thread_CPU_budget_algorithms          budget_algorithm;
341  /** This field is the method invoked with the budgeted time is consumed. */
342  Thread_CPU_budget_algorithm_callout   budget_callout;
343
344  /** This field is the amount of CPU time consumed by this thread
345   *  since it was created.
346   */
347  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
348    struct timespec                       cpu_time_used;
349  #else
350    uint32_t                              ticks_executed;
351  #endif
352  /** This field points to the Ready FIFO for this priority. */
353  Chain_Control                        *ready;
354  /** This field contains precalculated priority map indices. */
355  Priority_Information                  Priority_map;
356  /** This field contains information about the starting state of
357   *  this thread.
358   */
359  Thread_Start_information              Start;
360  /** This field contains the context of this thread. */
361  Context_Control                       Registers;
362#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
363  /** This field points to the floating point context for this thread.
364   *  If NULL, the thread is integer only.
365   */
366  Context_Control_fp                   *fp_context;
367#endif
368  /** This field points to the newlib reentrancy structure for this thread. */
369  struct _reent                        *libc_reent;
370  /** This array contains the API extension area pointers. */
371  void                                 *API_Extensions[ THREAD_API_LAST + 1 ];
372  /** This field points to the user extension pointers. */
373  void                                **extensions;
374  /** This field points to the set of per task variables. */
375  rtems_task_variable_t                *task_variables;
376};
377
378/**
379 *  Self for the GNU Ada Run-Time
380 */
381SCORE_EXTERN void *rtems_ada_self;
382
383/**
384 *  The following defines the information control block used to
385 *  manage this class of objects.
386 */
387SCORE_EXTERN Objects_Information _Thread_Internal_information;
388
389/**
390 *  The following define the thread control pointers used to access
391 *  and manipulate the idle thread.
392 */
393SCORE_EXTERN Thread_Control *_Thread_Idle;
394
395/**
396 *  The following context area contains the context of the "thread"
397 *  which invoked the start multitasking routine.  This context is
398 *  restored as the last action of the stop multitasking routine.  Thus
399 *  control of the processor can be returned to the environment
400 *  which initiated the system.
401 */
402SCORE_EXTERN Context_Control _Thread_BSP_context;
403
404/**
405 *  The following declares the dispatch critical section nesting
406 *  counter which is used to prevent context switches at inopportune
407 *  moments.
408 */
409SCORE_EXTERN volatile uint32_t   _Thread_Dispatch_disable_level;
410
411/**
412 *  If this is non-zero, then the post-task switch extension
413 *  is run regardless of the state of the per thread flag.
414 */
415SCORE_EXTERN uint32_t   _Thread_Do_post_task_switch_extension;
416
417/**
418 *  The following holds how many user extensions are in the system.  This
419 *  is used to determine how many user extension data areas to allocate
420 *  per thread.
421 */
422SCORE_EXTERN uint32_t   _Thread_Maximum_extensions;
423
424/**
425 *  The following is used to manage the length of a timeslice quantum.
426 */
427SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
428
429/**
430 *  The following points to the array of FIFOs used to manage the
431 *  set of ready threads.
432 */
433SCORE_EXTERN Chain_Control *_Thread_Ready_chain;
434
435/**
436 *  The following points to the thread which is currently executing.
437 *  This thread is implicitly manipulated by numerous directives.
438 */
439SCORE_EXTERN Thread_Control *_Thread_Executing;
440
441/**
442 *  The following points to the highest priority ready thread
443 *  in the system.  Unless the current thread is not preemptibl,
444 *  then this thread will be context switched to when the next
445 *  dispatch occurs.
446 */
447SCORE_EXTERN Thread_Control *_Thread_Heir;
448
449/**
450 *  The following points to the thread whose floating point
451 *  context is currently loaded.
452 */
453#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
454SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
455#endif
456
457/**
458 * The C library re-enter-rant global pointer. Some C library implementations
459 * such as newlib have a single global pointer that changed during a context
460 * switch. The pointer points to that global pointer. The Thread control block
461 * holds a pointer to the task specific data.
462 */
463SCORE_EXTERN struct _reent **_Thread_libc_reent;
464
465#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
466
467  /**
468   * This contains the time since boot when the last context switch occurred.
469   * By placing it in the BSS, it will automatically be zeroed out at
470   * system initialization and does not need to be known outside this
471   * file.
472   */
473  SCORE_EXTERN struct timespec _Thread_Time_of_last_context_switch;
474#endif
475
476/**
477 *  This routine performs the initialization necessary for this handler.
478 */
479void _Thread_Handler_initialization (
480  uint32_t     ticks_per_timeslice,
481  uint32_t     maximum_extensions
482#if defined(RTEMS_MULTIPROCESSING)
483  ,
484  uint32_t     maximum_proxies
485#endif
486);
487
488/**
489 *  This routine creates the idle thread.
490 *
491 *  @warning No thread should be created before this one.
492 */
493void _Thread_Create_idle( void );
494
495/**
496 *  This routine initiates multitasking.  It is invoked only as
497 *  part of initialization and its invocation is the last act of
498 *  the non-multitasking part of the system initialization.
499 */
500void _Thread_Start_multitasking( void );
501
502/**
503 *  This routine is responsible for transferring control of the
504 *  processor from the executing thread to the heir thread.  As part
505 *  of this process, it is responsible for the following actions:
506 *
507 *     + saving the context of the executing thread
508 *     + restoring the context of the heir thread
509 *     + dispatching any signals for the resulting executing thread
510 */
511void _Thread_Dispatch( void );
512
513/**
514 *  Allocate the requested stack space for the thread.
515 *  return the actual size allocated after any adjustment
516 *  or return zero if the allocation failed.
517 *  Set the Start.stack field to the address of the stack
518 */
519
520size_t _Thread_Stack_Allocate(
521  Thread_Control *the_thread,
522  size_t          stack_size
523);
524
525/**
526 *  Deallocate the Thread's stack.
527 */
528void _Thread_Stack_Free(
529  Thread_Control *the_thread
530);
531
532/**
533 *  This routine initializes the specified the thread.  It allocates
534 *  all memory associated with this thread.  It completes by adding
535 *  the thread to the local object table so operations on this
536 *  thread id are allowed.
537 *
538 *  @note If stack_area is NULL, it is allocated from the workspace.
539 *
540 *  @note If the stack is allocated from the workspace, then it is
541 *        guaranteed to be of at least minimum size.
542 */
543boolean _Thread_Initialize(
544  Objects_Information                  *information,
545  Thread_Control                       *the_thread,
546  void                                 *stack_area,
547  size_t                                stack_size,
548  boolean                               is_fp,
549  Priority_Control                      priority,
550  boolean                               is_preemptible,
551  Thread_CPU_budget_algorithms          budget_algorithm,
552  Thread_CPU_budget_algorithm_callout   budget_callout,
553  uint32_t                              isr_level,
554  Objects_Name                          name
555);
556
557/**
558 *  This routine initializes the executable information for a thread
559 *  and makes it ready to execute.  After this routine executes, the
560 *  thread competes with all other threads for CPU time.
561 */
562boolean _Thread_Start(
563  Thread_Control           *the_thread,
564  Thread_Start_types        the_prototype,
565  void                     *entry_point,
566  void                     *pointer_argument,
567  uint32_t                  numeric_argument
568);
569
570/**
571 *  This support routine restarts the specified task in a way that the
572 *  next time this thread executes, it will begin execution at its
573 *  original starting point.
574 *
575 *  TODO:  multiple task arg profiles
576 */
577boolean _Thread_Restart(
578  Thread_Control           *the_thread,
579  void                     *pointer_argument,
580  uint32_t                  numeric_argument
581);
582
583/**
584 *  This routine resets a thread to its initial state but does
585 *  not restart it.
586 */
587void _Thread_Reset(
588  Thread_Control      *the_thread,
589  void                *pointer_argument,
590  uint32_t             numeric_argument
591);
592
593/**
594 *  This routine frees all memory associated with the specified
595 *  thread and removes it from the local object table so no further
596 *  operations on this thread are allowed.
597 */
598void _Thread_Close(
599  Objects_Information  *information,
600  Thread_Control       *the_thread
601);
602
603/**
604 *  This routine removes any set states for the_thread.  It performs
605 *  any necessary scheduling operations including the selection of
606 *  a new heir thread.
607 */
608void _Thread_Ready(
609  Thread_Control *the_thread
610);
611
612/**
613 *  This routine clears the indicated STATES for the_thread.  It performs
614 *  any necessary scheduling operations including the selection of
615 *  a new heir thread.
616 */
617void _Thread_Clear_state(
618  Thread_Control *the_thread,
619  States_Control  state
620);
621
622/**
623 *  This routine sets the indicated states for the_thread.  It performs
624 *  any necessary scheduling operations including the selection of
625 *  a new heir thread.
626 */
627void _Thread_Set_state(
628  Thread_Control *the_thread,
629  States_Control  state
630);
631
632/**
633 *  This routine sets the TRANSIENT state for the_thread.  It performs
634 *  any necessary scheduling operations including the selection of
635 *  a new heir thread.
636 */
637void _Thread_Set_transient(
638  Thread_Control *the_thread
639);
640
641/**
642 *  This routine is invoked upon expiration of the currently
643 *  executing thread's timeslice.  If no other thread's are ready
644 *  at the priority of the currently executing thread, then the
645 *  executing thread's timeslice is reset.  Otherwise, the
646 *  currently executing thread is placed at the rear of the
647 *  FIFO for this priority and a new heir is selected.
648 */
649void _Thread_Reset_timeslice( void );
650
651/**
652 *  This routine is invoked as part of processing each clock tick.
653 *  It is responsible for determining if the current thread allows
654 *  timeslicing and, if so, when its timeslice expires.
655 */
656void _Thread_Tickle_timeslice( void );
657
658/**
659 *  This routine is invoked when a thread wishes to voluntarily
660 *  transfer control of the processor to another thread of equal
661 *  or greater priority.
662 */
663void _Thread_Yield_processor( void );
664
665/**
666 *  This routine is invoked to rotate the ready queue for the
667 *  given priority.  It can be used to yeild the processor
668 *  by rotating the executing threads ready queue.
669 */
670void _Thread_Rotate_Ready_Queue(
671  Priority_Control  priority
672);
673
674/**
675 *  This routine initializes the context of the_thread to its
676 *  appropriate starting state.
677 */
678void _Thread_Load_environment(
679  Thread_Control *the_thread
680);
681
682/**
683 *  This routine is the wrapper function for all threads.  It is
684 *  the starting point for all threads.  The user provided thread
685 *  entry point is invoked by this routine.  Operations
686 *  which must be performed immediately before and after the user's
687 *  thread executes are found here.
688 */
689void _Thread_Handler( void );
690
691/**
692 *  This routine is invoked when a thread must be unblocked at the
693 *  end of a time based delay (i.e. wake after or wake when).
694 */
695void _Thread_Delay_ended(
696  Objects_Id  id,
697  void       *ignored
698);
699
700/**
701 *  This routine changes the current priority of the_thread to
702 *  new_priority.  It performs any necessary scheduling operations
703 *  including the selection of a new heir thread.
704 */
705void _Thread_Change_priority (
706  Thread_Control   *the_thread,
707  Priority_Control  new_priority,
708  boolean           prepend_it
709);
710
711/**
712 *  This routine updates the priority related fields in the_thread
713 *  control block to indicate the current priority is now new_priority.
714 */
715void _Thread_Set_priority(
716  Thread_Control   *the_thread,
717  Priority_Control  new_priority
718);
719
720/**
721 *  This routine updates the related suspend fields in the_thread
722 *  control block to indicate the current nested level.
723 */
724void _Thread_Suspend(
725  Thread_Control   *the_thread
726);
727
728/**
729 *  This routine updates the related suspend fields in the_thread
730 *  control block to indicate the current nested level.  A force
731 *  parameter of TRUE will force a resume and clear the suspend count.
732 */
733void _Thread_Resume(
734  Thread_Control   *the_thread,
735  boolean           force
736);
737
738/**
739 *  This routine evaluates the current scheduling information for the
740 *  system and determines if a context switch is required.  This
741 *  is usually called after changing an execution mode such as preemptability
742 *  for a thread.
743 */
744boolean _Thread_Evaluate_mode( void );
745
746#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
747/**
748 *  This routine is the body of the system idle thread.
749 */
750Thread _Thread_Idle_body(
751  uint32_t   ignored
752);
753#endif
754
755/**  This defines the type for a method which operates on a single thread.
756 */
757typedef void (*rtems_per_thread_routine)( Thread_Control * );
758
759/**
760 *  This routine iterates over all threads regardless of API and
761 *  invokes the specified routine.
762 */
763void rtems_iterate_over_all_threads(
764  rtems_per_thread_routine routine
765);
766
767/**
768 *  This function maps thread IDs to thread control
769 *  blocks.  If ID corresponds to a local thread, then it
770 *  returns the_thread control pointer which maps to ID
771 *  and location is set to OBJECTS_LOCAL.  If the thread ID is
772 *  global and resides on a remote node, then location is set
773 *  to OBJECTS_REMOTE, and the_thread is undefined.
774 *  Otherwise, location is set to OBJECTS_ERROR and
775 *  the_thread is undefined.
776 *
777 *  @note  The performance of many RTEMS services depends upon
778 *         the quick execution of the "good object" path in this
779 *         routine.  If there is a possibility of saving a few
780 *         cycles off the execution time, this routine is worth
781 *         further optimization attention.
782 */
783Thread_Control *_Thread_Get (
784  Objects_Id         id,
785  Objects_Locations *location
786);
787
788#ifndef __RTEMS_APPLICATION__
789#include <rtems/score/thread.inl>
790#endif
791#if defined(RTEMS_MULTIPROCESSING)
792#include <rtems/score/threadmp.h>
793#endif
794
795#ifdef __cplusplus
796}
797#endif
798
799/**@}*/
800
801#endif
802/* end of include file */
Note: See TracBrowser for help on using the repository browser.