source: rtems/cpukit/score/include/rtems/score/thread.h @ 484a769

4.104.114.95
Last change on this file since 484a769 was 484a769, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 17:46:39

Convert to "bool".

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