source: rtems-docs/ada_user/task_manager.rst @ 1a1be7f

4.115
Last change on this file since 1a1be7f was 4783b0d, checked in by Amar Takhar <amar@…>, on 01/17/16 at 16:37:28

Split document into seperate files by section.

  • Property mode set to 100644
File size: 50.4 KB
Line 
1Task Manager
2############
3
4.. index:: tasks
5
6Introduction
7============
8
9The task manager provides a comprehensive set of directives to
10create, delete, and administer tasks.  The directives provided
11by the task manager are:
12
13- ``rtems.task_create`` - Create a task
14
15- ``rtems.task_ident`` - Get ID of a task
16
17- ``rtems.task_self`` - Obtain ID of caller
18
19- ``rtems.task_start`` - Start a task
20
21- ``rtems.task_restart`` - Restart a task
22
23- ``rtems.task_delete`` - Delete a task
24
25- ``rtems.task_suspend`` - Suspend a task
26
27- ``rtems.task_resume`` - Resume a task
28
29- ``rtems.task_is_suspended`` - Determine if a task is suspended
30
31- ``rtems.task_set_priority`` - Set task priority
32
33- ``rtems.task_mode`` - Change current task’s mode
34
35- ``rtems.task_wake_after`` - Wake up after interval
36
37- ``rtems.task_wake_when`` - Wake up when specified
38
39- ``rtems.iterate_over_all_threads`` - Iterate Over Tasks
40
41- ``rtems.task_variable_add`` - Associate per task variable
42
43- ``rtems.task_variable_get`` - Obtain value of a a per task variable
44
45- ``rtems.task_variable_delete`` - Remove per task variable
46
47Background
48==========
49
50Task Definition
51---------------
52.. index:: task, definition
53
54Many definitions of a task have been proposed in computer literature.
55Unfortunately, none of these definitions encompasses all facets of the
56concept in a manner which is operating system independent.  Several of the
57more common definitions are provided to enable each user to select a
58definition which best matches their own experience and understanding of the
59task concept:
60
61- a "dispatchable" unit.
62
63- an entity to which the processor is allocated.
64
65- an atomic unit of a real-time, multiprocessor system.
66
67- single threads of execution which concurrently compete for resources.
68
69- a sequence of closely related computations which can execute
70  concurrently with other computational sequences.
71
72From RTEMS’ perspective, a task is the smallest thread of
73execution which can compete on its own for system resources.  A
74task is manifested by the existence of a task control block
75(TCB).
76
77Task Control Block
78------------------
79
80The Task Control Block (TCB) is an RTEMS defined data structure
81which contains all the information that is pertinent to the
82execution of a task.  During system initialization, RTEMS
83reserves a TCB for each task configured.  A TCB is allocated
84upon creation of the task and is returned to the TCB free list
85upon deletion of the task.
86
87The TCB’s elements are modified as a result of system calls made
88by the application in response to external and internal stimuli.
89TCBs are the only RTEMS internal data structure that can be
90accessed by an application via user extension routines.  The TCB
91contains a task’s name, ID, current priority, current and
92starting states, execution mode, TCB user extension pointer,
93scheduling control structures, as well as data required by a
94blocked task.
95
96A task’s context is stored in the TCB when a task switch occurs.
97When the task regains control of the processor, its context is
98restored from the TCB.  When a task is restarted, the initial
99state of the task is restored from the starting context area in
100the task’s TCB.
101
102Task States
103-----------
104.. index:: task states
105
106A task may exist in one of the following five states:
107
108- *executing* - Currently scheduled to the CPU
109
110- *ready* - May be scheduled to the CPU
111
112- *blocked* - Unable to be scheduled to the CPU
113
114- *dormant* - Created task that is not started
115
116- *non-existent* - Uncreated or deleted task
117
118An active task may occupy the executing, ready, blocked or
119dormant state, otherwise the task is considered non-existent.
120One or more tasks may be active in the system simultaneously.
121Multiple tasks communicate, synchronize, and compete for system
122resources with each other via system calls.  The multiple tasks
123appear to execute in parallel, but actually each is dispatched
124to the CPU for periods of time determined by the RTEMS
125scheduling algorithm.  The scheduling of a task is based on its
126current state and priority.
127
128Task Priority
129-------------
130.. index:: task priority
131.. index:: priority, task
132.. index:: rtems_task_priority
133
134A task’s priority determines its importance in relation to the
135other tasks executing on the same processor.  RTEMS supports 255
136levels of priority ranging from 1 to 255.  The data type``rtems.task_priority`` is used to store task
137priorities.
138
139Tasks of numerically
140smaller priority values are more important tasks than tasks of
141numerically larger priority values.  For example, a task at
142priority level 5 is of higher privilege than a task at priority
143level 10.  There is no limit to the number of tasks assigned to
144the same priority.
145
146Each task has a priority associated with it at all times.  The
147initial value of this priority is assigned at task creation
148time.  The priority of a task may be changed at any subsequent
149time.
150
151Priorities are used by the scheduler to determine which ready
152task will be allowed to execute.  In general, the higher the
153logical priority of a task, the more likely it is to receive
154processor execution time.
155
156Task Mode
157---------
158.. index:: task mode
159.. index:: rtems_task_mode
160
161A task’s execution mode is a combination of the following
162four components:
163
164- preemption
165
166- ASR processing
167
168- timeslicing
169
170- interrupt level
171
172It is used to modify RTEMS’ scheduling process and to alter the
173execution environment of the task.  The data type``rtems.task_mode`` is used to manage the task
174execution mode... index:: preemption
175
176The preemption component allows a task to determine when control of the
177processor is relinquished.  If preemption is disabled
178(``RTEMS.NO_PREEMPT``), the task will retain control of the
179processor as long as it is in the executing state – even if a higher
180priority task is made ready.  If preemption is enabled
181(``RTEMS.PREEMPT``)  and a higher priority task is made ready,
182then the processor will be taken away from the current task immediately and
183given to the higher priority task... index:: timeslicing
184
185The timeslicing component is used by the RTEMS scheduler to determine how
186the processor is allocated to tasks of equal priority.  If timeslicing is
187enabled (``RTEMS.TIMESLICE``), then RTEMS will limit the amount
188of time the task can execute before the processor is allocated to another
189ready task of equal priority. The length of the timeslice is application
190dependent and specified in the Configuration Table.  If timeslicing is
191disabled (``RTEMS.NO_TIMESLICE``), then the task will be
192allowed to execute until a task of higher priority is made ready.  If``RTEMS.NO_PREEMPT`` is selected, then the timeslicing
193component is ignored by the scheduler.
194
195The asynchronous signal processing component is used to determine when
196received signals are to be processed by the task.
197If signal processing is enabled (``RTEMS.ASR``), then signals
198sent to the task will be processed the next time the task executes.  If
199signal processing is disabled (``RTEMS.NO_ASR``), then all
200signals received by the task will remain posted until signal processing is
201enabled.  This component affects only tasks which have established a
202routine to process asynchronous signals... index:: interrupt level, task
203
204The interrupt level component is used to determine which
205interrupts will be enabled when the task is executing.``RTEMS.INTERRUPT_LEVEL(n)``
206specifies that the task will execute at interrupt level n.
207
208- ``RTEMS.PREEMPT`` - enable preemption (default)
209
210- ``RTEMS.NO_PREEMPT`` - disable preemption
211
212- ``RTEMS.NO_TIMESLICE`` - disable timeslicing (default)
213
214- ``RTEMS.TIMESLICE`` - enable timeslicing
215
216- ``RTEMS.ASR`` - enable ASR processing (default)
217
218- ``RTEMS.NO_ASR`` - disable ASR processing
219
220- ``RTEMS.INTERRUPT_LEVEL(0)`` - enable all interrupts (default)
221
222- ``RTEMS.INTERRUPT_LEVEL(n)`` - execute at interrupt level n
223
224The set of default modes may be selected by specifying the``RTEMS.DEFAULT_MODES`` constant.
225
226Accessing Task Arguments
227------------------------
228.. index:: task arguments
229.. index:: task prototype
230
231All RTEMS tasks are invoked with a single argument which is
232specified when they are started or restarted.  The argument is
233commonly used to communicate startup information to the task.
234The simplest manner in which to define a task which accesses it
235argument is:
236
237.. code:: c
238
239    procedure User_Task (
240    Argument : in    RTEMS.Task_Argument_Ptr
241    );
242
243Application tasks requiring more information may view this
244single argument as an index into an array of parameter blocks.
245
246Floating Point Considerations
247-----------------------------
248.. index:: floating point
249
250Creating a task with the ``RTEMS.FLOATING_POINT`` attribute
251flag results
252in additional memory being allocated for the TCB to store the state of the
253numeric coprocessor during task switches.  This additional memory is*NOT* allocated for ``RTEMS.NO_FLOATING_POINT`` tasks. Saving
254and restoring the context of a ``RTEMS.FLOATING_POINT`` task
255takes longer than that of a ``RTEMS.NO_FLOATING_POINT`` task
256because of the relatively large amount of time required for the numeric
257coprocessor to save or restore its computational state.
258
259Since RTEMS was designed specifically for embedded military applications
260which are floating point intensive, the executive is optimized to avoid
261unnecessarily saving and restoring the state of the numeric coprocessor.
262The state of the numeric coprocessor is only saved when a``RTEMS.FLOATING_POINT`` task is dispatched and that task was
263not the last task to utilize the coprocessor.  In a system with only one``RTEMS.FLOATING_POINT`` task, the state of the numeric
264coprocessor will never be saved or restored.
265
266Although the overhead imposed by ``RTEMS.FLOATING_POINT`` tasks
267is minimal, some applications may wish to completely avoid the overhead
268associated with ``RTEMS.FLOATING_POINT`` tasks and still
269utilize a numeric coprocessor.  By preventing a task from being preempted
270while performing a sequence of floating point operations, a``RTEMS.NO_FLOATING_POINT`` task can utilize the numeric
271coprocessor without incurring the overhead of a``RTEMS.FLOATING_POINT`` context switch.  This approach also
272avoids the allocation of a floating point context area.  However, if this
273approach is taken by the application designer, NO tasks should be created
274as ``RTEMS.FLOATING_POINT`` tasks.  Otherwise, the floating
275point context will not be correctly maintained because RTEMS assumes that
276the state of the numeric coprocessor will not be altered by``RTEMS.NO_FLOATING_POINT`` tasks.
277
278If the supported processor type does not have hardware floating
279capabilities or a standard numeric coprocessor, RTEMS will not provide
280built-in support for hardware floating point on that processor.  In this
281case, all tasks are considered ``RTEMS.NO_FLOATING_POINT``
282whether created as ``RTEMS.FLOATING_POINT`` or``RTEMS.NO_FLOATING_POINT`` tasks.  A floating point emulation
283software library must be utilized for floating point operations.
284
285On some processors, it is possible to disable the floating point unit
286dynamically.  If this capability is supported by the target processor, then
287RTEMS will utilize this capability to enable the floating point unit only
288for tasks which are created with the ``RTEMS.FLOATING_POINT``
289attribute.  The consequence of a ``RTEMS.NO_FLOATING_POINT``
290task attempting to access the floating point unit is CPU dependent but will
291generally result in an exception condition.
292
293Per Task Variables
294------------------
295.. index:: per task variables
296
297Per task variables are deprecated, see the warning below.
298
299Per task variables are used to support global variables whose value
300may be unique to a task. After indicating that a variable should be
301treated as private (i.e. per-task) the task can access and modify the
302variable, but the modifications will not appear to other tasks, and
303other tasks’ modifications to that variable will not affect the value
304seen by the task.  This is accomplished by saving and restoring the
305variable’s value each time a task switch occurs to or from the calling task.
306
307The value seen by other tasks, including those which have not added the
308variable to their set and are thus accessing the variable as a common
309location shared among tasks, cannot be affected by a task once it has
310added a variable to its local set.  Changes made to the variable by
311other tasks will not affect the value seen by a task which has added the
312variable to its private set.
313
314This feature can be used when a routine is to be spawned repeatedly as
315several independent tasks.  Although each task will have its own stack,
316and thus separate stack variables, they will all share the same static and
317global variables.  To make a variable not shareable (i.e. a "global" variable
318that is specific to a single task), the tasks can call``rtems_task_variable_add`` to make a separate copy of the variable
319for each task, but all at the same physical address.
320
321Task variables increase the context switch time to and from the
322tasks that own them so it is desirable to minimize the number of
323task variables.  One efficient method is to have a single task
324variable that is a pointer to a dynamically allocated structure
325containing the task’s private "global" data.
326
327A critical point with per-task variables is that each task must separately
328request that the same global variable is per-task private.
329
330*WARNING*: Per-Task variables are inherently broken on SMP systems. They
331only work correctly when there is one task executing in the system and
332that task is the logical owner of the value in the per-task variable’s
333location. There is no way for a single memory image to contain the
334correct value for each task executing on each core. Consequently,
335per-task variables are disabled in SMP configurations of RTEMS.
336Instead the application developer should
337consider the use of POSIX Keys or Thread Local Storage (TLS). POSIX Keys
338are not enabled in all RTEMS configurations.
339
340Building a Task Attribute Set
341-----------------------------
342.. index:: task attributes, building
343
344In general, an attribute set is built by a bitwise OR of the
345desired components.  The set of valid task attribute components
346is listed below:
347
348- ``RTEMS.NO_FLOATING_POINT`` - does not use coprocessor (default)
349
350- ``RTEMS.FLOATING_POINT`` - uses numeric coprocessor
351
352- ``RTEMS.LOCAL`` - local task (default)
353
354- ``RTEMS.GLOBAL`` - global task
355
356Attribute values are specifically designed to be mutually
357exclusive, therefore bitwise OR and addition operations are
358equivalent as long as each attribute appears exactly once in the
359component list.  A component listed as a default is not required
360to appear in the component list, although it is a good
361programming practice to specify default components.  If all
362defaults are desired, then ``RTEMS.DEFAULT_ATTRIBUTES`` should be used.
363
364This example demonstrates the attribute_set parameter needed to
365create a local task which utilizes the numeric coprocessor.  The
366attribute_set parameter could be ``RTEMS.FLOATING_POINT`` or``RTEMS.LOCAL or RTEMS.FLOATING_POINT``.
367The attribute_set parameter can be set to``RTEMS.FLOATING_POINT`` because ``RTEMS.LOCAL`` is the default for all created
368tasks.  If the task were global and used the numeric
369coprocessor, then the attribute_set parameter would be``RTEMS.GLOBAL or RTEMS.FLOATING_POINT``.
370
371Building a Mode and Mask
372------------------------
373.. index:: task mode, building
374
375In general, a mode and its corresponding mask is built by a
376bitwise OR of the desired components.  The set of valid mode
377constants and each mode’s corresponding mask constant is
378listed below:
379
380- ``RTEMS.PREEMPT`` is masked by``RTEMS.PREEMPT_MASK`` and enables preemption
381
382- ``RTEMS.NO_PREEMPT`` is masked by``RTEMS.PREEMPT_MASK`` and disables preemption
383
384- ``RTEMS.NO_TIMESLICE`` is masked by``RTEMS.TIMESLICE_MASK`` and disables timeslicing
385
386- ``RTEMS.TIMESLICE`` is masked by``RTEMS.TIMESLICE_MASK`` and enables timeslicing
387
388- ``RTEMS.ASR`` is masked by``RTEMS.ASR_MASK`` and enables ASR processing
389
390- ``RTEMS.NO_ASR`` is masked by``RTEMS.ASR_MASK`` and disables ASR processing
391
392- ``RTEMS.INTERRUPT_LEVEL(0)`` is masked by``RTEMS.INTERRUPT_MASK`` and enables all interrupts
393
394- ``RTEMS.INTERRUPT_LEVEL(n)`` is masked by``RTEMS.INTERRUPT_MASK`` and sets interrupts level n
395
396Mode values are specifically designed to be mutually exclusive, therefore
397bitwise OR and addition operations are equivalent as long as each mode
398appears exactly once in the component list.  A mode component listed as a
399default is not required to appear in the mode component list, although it
400is a good programming practice to specify default components.  If all
401defaults are desired, the mode ``RTEMS.DEFAULT_MODES`` and the
402mask ``RTEMS.ALL_MODE_MASKS`` should be used.
403
404The following example demonstrates the mode and mask parameters used with
405the ``rtems.task_mode``
406directive to place a task at interrupt level 3 and make it
407non-preemptible.  The mode should be set to``RTEMS.INTERRUPT_LEVEL(3)  or
408RTEMS.NO_PREEMPT`` to indicate the desired preemption mode and
409interrupt level, while the mask parameter should be set to``RTEMS.INTERRUPT_MASK or
410RTEMS.NO_PREEMPT_MASK`` to indicate that the calling task’s
411interrupt level and preemption mode are being altered.
412
413Operations
414==========
415
416Creating Tasks
417--------------
418
419The ``rtems.task_create``
420directive creates a task by allocating a task
421control block, assigning the task a user-specified name,
422allocating it a stack and floating point context area, setting a
423user-specified initial priority, setting a user-specified
424initial mode, and assigning it a task ID.  Newly created tasks
425are initially placed in the dormant state.  All RTEMS tasks
426execute in the most privileged mode of the processor.
427
428Obtaining Task IDs
429------------------
430
431When a task is created, RTEMS generates a unique task ID and
432assigns it to the created task until it is deleted.  The task ID
433may be obtained by either of two methods.  First, as the result
434of an invocation of the ``rtems.task_create``
435directive, the task ID is
436stored in a user provided location.  Second, the task ID may be
437obtained later using the ``rtems.task_ident``
438directive.  The task ID is
439used by other directives to manipulate this task.
440
441Starting and Restarting Tasks
442-----------------------------
443
444The ``rtems.task_start``
445directive is used to place a dormant task in the
446ready state.  This enables the task to compete, based on its
447current priority, for the processor and other system resources.
448Any actions, such as suspension or change of priority, performed
449on a task prior to starting it are nullified when the task is
450started.
451
452With the ``rtems.task_start``
453directive the user specifies the task’s
454starting address and argument.  The argument is used to
455communicate some startup information to the task.  As part of
456this directive, RTEMS initializes the task’s stack based upon
457the task’s initial execution mode and start address.  The
458starting argument is passed to the task in accordance with the
459target processor’s calling convention.
460
461The ``rtems.task_restart``
462directive restarts a task at its initial
463starting address with its original priority and execution mode,
464but with a possibly different argument.  The new argument may be
465used to distinguish between the original invocation of the task
466and subsequent invocations.  The task’s stack and control block
467are modified to reflect their original creation values.
468Although references to resources that have been requested are
469cleared, resources allocated by the task are NOT automatically
470returned to RTEMS.  A task cannot be restarted unless it has
471previously been started (i.e. dormant tasks cannot be
472restarted).  All restarted tasks are placed in the ready state.
473
474Suspending and Resuming Tasks
475-----------------------------
476
477The ``rtems.task_suspend``
478directive is used to place either the caller or
479another task into a suspended state.  The task remains suspended
480until a ``rtems.task_resume``
481directive is issued.  This implies that a
482task may be suspended as well as blocked waiting either to
483acquire a resource or for the expiration of a timer.
484
485The ``rtems.task_resume``
486directive is used to remove another task from
487the suspended state. If the task is not also blocked, resuming
488it will place it in the ready state, allowing it to once again
489compete for the processor and resources.  If the task was
490blocked as well as suspended, this directive clears the
491suspension and leaves the task in the blocked state.
492
493Suspending a task which is already suspended or resuming a
494task which is not suspended is considered an error.
495The ``rtems.task_is_suspended`` can be used to
496determine if a task is currently suspended.
497
498Delaying the Currently Executing Task
499-------------------------------------
500
501The ``rtems.task_wake_after`` directive creates a sleep timer
502which allows a task to go to sleep for a specified interval.  The task is
503blocked until the delay interval has elapsed, at which time the task is
504unblocked.  A task calling the ``rtems.task_wake_after``
505directive with a delay
506interval of ``RTEMS.YIELD_PROCESSOR`` ticks will yield the
507processor to any other ready task of equal or greater priority and remain
508ready to execute.
509
510The ``rtems.task_wake_when``
511directive creates a sleep timer which allows
512a task to go to sleep until a specified date and time.  The
513calling task is blocked until the specified date and time has
514occurred, at which time the task is unblocked.
515
516Changing Task Priority
517----------------------
518
519The ``rtems.task_set_priority``
520directive is used to obtain or change the
521current priority of either the calling task or another task.  If
522the new priority requested is``RTEMS.CURRENT_PRIORITY`` or the task’s
523actual priority, then the current priority will be returned and
524the task’s priority will remain unchanged.  If the task’s
525priority is altered, then the task will be scheduled according
526to its new priority.
527
528The ``rtems.task_restart``
529directive resets the priority of a task to its
530original value.
531
532Changing Task Mode
533------------------
534
535The ``rtems.task_mode``
536directive is used to obtain or change the current
537execution mode of the calling task.  A task’s execution mode is
538used to enable preemption, timeslicing, ASR processing, and to
539set the task’s interrupt level.
540
541The ``rtems.task_restart``
542directive resets the mode of a task to its
543original value.
544
545Task Deletion
546-------------
547
548RTEMS provides the ``rtems.task_delete``
549directive to allow a task to
550delete itself or any other task.  This directive removes all
551RTEMS references to the task, frees the task’s control block,
552removes it from resource wait queues, and deallocates its stack
553as well as the optional floating point context.  The task’s name
554and ID become inactive at this time, and any subsequent
555references to either of them is invalid.  In fact, RTEMS may
556reuse the task ID for another task which is created later in the
557application.
558
559Unexpired delay timers (i.e. those used by``rtems.task_wake_after`` and``rtems.task_wake_when``) and
560timeout timers associated with the task are
561automatically deleted, however, other resources dynamically
562allocated by the task are NOT automatically returned to RTEMS.
563Therefore, before a task is deleted, all of its dynamically
564allocated resources should be deallocated by the user.  This may
565be accomplished by instructing the task to delete itself rather
566than directly deleting the task.  Other tasks may instruct a
567task to delete itself by sending a "delete self" message, event,
568or signal, or by restarting the task with special arguments
569which instruct the task to delete itself.
570
571Transition Advice for Obsolete Directives
572-----------------------------------------
573
574Notepads
575~~~~~~~~
576
577Task notepads and the associated directives``rtems.task_get_note`` and``rtems.task_set_note`` were removed after the 4.11 Release
578Series. These were never thread-safe to access and subject to conflicting
579use of the notepad index by libraries which were designed independently.
580
581It is recommended that applications be modified to use services
582which are thread safe and not subject to issues with multiple applications
583conflicting over the key (e.g. notepad index) selection. For most
584applications, POSIX Keys should be used. These are available in all RTEMS
585build configurations. It is also possible that Thread Local Storage is
586an option for some use cases.
587
588Directives
589==========
590
591This section details the task manager’s directives.  A
592subsection is dedicated to each of this manager’s directives and
593describes the calling sequence, related constants, usage, and
594status codes.
595
596TASK_CREATE - Create a task
597---------------------------
598.. index:: create a task
599
600**CALLING SEQUENCE:**
601
602.. code:: c
603
604    procedure Task_Create (
605    Name             : in     RTEMS.Name;
606    Initial_Priority : in     RTEMS.Task_Priority;
607    Stack_Size       : in     RTEMS.Unsigned32;
608    Initial_Modes    : in     RTEMS.Mode;
609    Attribute_Set    : in     RTEMS.Attribute;
610    ID               :    out RTEMS.ID;
611    Result           :    out RTEMS.Status_Codes
612    );
613
614**DIRECTIVE STATUS CODES:**
615
616``RTEMS.SUCCESSFUL`` - task created successfully
617``RTEMS.INVALID_ADDRESS`` - ``id`` is NULL
618``RTEMS.INVALID_NAME`` - invalid task name
619``RTEMS.INVALID_PRIORITY`` - invalid task priority
620``RTEMS.MP_NOT_CONFIGURED`` - multiprocessing not configured
621``RTEMS.TOO_MANY`` - too many tasks created
622``RTEMS.UNSATISFIED`` - not enough memory for stack/FP context
623``RTEMS.TOO_MANY`` - too many global objects
624
625**DESCRIPTION:**
626
627This directive creates a task which resides on the local node.
628It allocates and initializes a TCB, a stack, and an optional
629floating point context area.  The mode parameter contains values
630which sets the task’s initial execution mode.  The``RTEMS.FLOATING_POINT`` attribute should be
631specified if the created task
632is to use a numeric coprocessor.  For performance reasons, it is
633recommended that tasks not using the numeric coprocessor should
634specify the ``RTEMS.NO_FLOATING_POINT`` attribute.
635If the ``RTEMS.GLOBAL``
636attribute is specified, the task can be accessed from remote
637nodes.  The task id, returned in id, is used in other task
638related directives to access the task.  When created, a task is
639placed in the dormant state and can only be made ready to
640execute using the directive ``rtems.task_start``.
641
642**NOTES:**
643
644This directive will not cause the calling task to be preempted.
645
646Valid task priorities range from a high of 1 to a low of 255.
647
648If the requested stack size is less than the configured
649minimum stack size, then RTEMS will use the configured
650minimum as the stack size for this task.  In addition
651to being able to specify the task stack size as a integer,
652there are two constants which may be specified:
653
654- ``RTEMS.MINIMUM_STACK_SIZE``
655  is the minimum stack size *RECOMMENDED* for use on this processor.
656  This value is selected by the RTEMS developers conservatively to
657  minimize the risk of blown stacks for most user applications.
658  Using this constant when specifying the task stack size, indicates
659  that the stack size will be at least``RTEMS.MINIMUM_STACK_SIZE`` bytes in size.  If the
660  user configured minimum stack size is larger than the recommended
661  minimum, then it will be used.
662
663- ``RTEMS.CONFIGURED_MINIMUM_STACK_SIZE``
664  indicates that this task is to be created with a stack size
665  of the minimum stack size that was configured by the application.
666  If not explicitly configured by the application, the default
667  configured minimum stack size is the processor dependent value``RTEMS.MINIMUM_STACK_SIZE``.  Since this uses
668  the configured minimum stack size value, you may get a stack
669  size that is smaller or larger than the recommended minimum.  This
670  can be used to provide large stacks for all tasks on complex
671  applications or small stacks on applications that are trying
672  to conserve memory.
673
674Application developers should consider the stack usage of the
675device drivers when calculating the stack size required for
676tasks which utilize the driver.
677
678The following task attribute constants are defined by RTEMS:
679
680- ``RTEMS.NO_FLOATING_POINT`` - does not use coprocessor (default)
681
682- ``RTEMS.FLOATING_POINT`` - uses numeric coprocessor
683
684- ``RTEMS.LOCAL`` - local task (default)
685
686- ``RTEMS.GLOBAL`` - global task
687
688The following task mode constants are defined by RTEMS:
689
690- ``RTEMS.PREEMPT`` - enable preemption (default)
691
692- ``RTEMS.NO_PREEMPT`` - disable preemption
693
694- ``RTEMS.NO_TIMESLICE`` - disable timeslicing (default)
695
696- ``RTEMS.TIMESLICE`` - enable timeslicing
697
698- ``RTEMS.ASR`` - enable ASR processing (default)
699
700- ``RTEMS.NO_ASR`` - disable ASR processing
701
702- ``RTEMS.INTERRUPT_LEVEL(0)`` - enable all interrupts (default)
703
704- ``RTEMS.INTERRUPT_LEVEL(n)`` - execute at interrupt level n
705
706The interrupt level portion of the task execution mode
707supports a maximum of 256 interrupt levels.  These levels are
708mapped onto the interrupt levels actually supported by the
709target processor in a processor dependent fashion.
710
711Tasks should not be made global unless remote tasks must
712interact with them.  This avoids the system overhead incurred by
713the creation of a global task.  When a global task is created,
714the task’s name and id must be transmitted to every node in the
715system for insertion in the local copy of the global object
716table.
717
718The total number of global objects, including tasks, is limited
719by the maximum_global_objects field in the Configuration Table.
720
721TASK_IDENT - Get ID of a task
722-----------------------------
723.. index:: get ID of a task
724
725**CALLING SEQUENCE:**
726
727.. code:: c
728
729    procedure Task_Ident (
730    Name   : in     RTEMS.Name;
731    Node   : in     RTEMS.Node;
732    ID     :    out RTEMS.ID;
733    Result :    out RTEMS.Status_Codes
734    );
735
736**DIRECTIVE STATUS CODES:**
737
738``RTEMS.SUCCESSFUL`` - task identified successfully
739``RTEMS.INVALID_ADDRESS`` - ``id`` is NULL
740``RTEMS.INVALID_NAME`` - invalid task name
741``RTEMS.INVALID_NODE`` - invalid node id
742
743**DESCRIPTION:**
744
745This directive obtains the task id associated with the task name
746specified in name.  A task may obtain its own id by specifying``RTEMS.SELF`` or its own task name in name.  If the task name is not
747unique, then the task id returned will match one of the tasks
748with that name.  However, this task id is not guaranteed to
749correspond to the desired task.  The task id, returned in id, is
750used in other task related directives to access the task.
751
752**NOTES:**
753
754This directive will not cause the running task to be preempted.
755
756If node is ``RTEMS.SEARCH_ALL_NODES``, all nodes are searched with the
757local node being searched first.  All other nodes are searched
758with the lowest numbered node searched first.
759
760If node is a valid node number which does not represent the
761local node, then only the tasks exported by the designated node
762are searched.
763
764This directive does not generate activity on remote nodes.  It
765accesses only the local copy of the global object table.
766
767TASK_SELF - Obtain ID of caller
768-------------------------------
769.. index:: obtain ID of caller
770
771**CALLING SEQUENCE:**
772
773.. code:: c
774
775    function Task_Self return RTEMS.ID;
776
777**DIRECTIVE STATUS CODES:**
778
779Returns the object Id of the calling task.
780
781**DESCRIPTION:**
782
783This directive returns the Id of the calling task.
784
785**NOTES:**
786
787If called from an interrupt service routine, this directive
788will return the Id of the interrupted task.
789
790TASK_START - Start a task
791-------------------------
792.. index:: starting a task
793
794**CALLING SEQUENCE:**
795
796.. code:: c
797
798    procedure Task_Start (
799    ID          : in     RTEMS.ID;
800    Entry_Point : in     RTEMS.Task_Entry;
801    Argument    : in     RTEMS.Task_Argument;
802    Result      :    out RTEMS.Status_Codes
803    );
804
805**DIRECTIVE STATUS CODES:**
806
807``RTEMS.SUCCESSFUL`` - ask started successfully
808``RTEMS.INVALID_ADDRESS`` - invalid task entry point
809``RTEMS.INVALID_ID`` - invalid task id
810``RTEMS.INCORRECT_STATE`` - task not in the dormant state
811``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - cannot start remote task
812
813**DESCRIPTION:**
814
815This directive readies the task, specified by ``id``, for execution
816based on the priority and execution mode specified when the task
817was created.  The starting address of the task is given in``entry_point``.  The task’s starting argument is contained in
818argument.  This argument can be a single value or used as an index into an
819array of parameter blocks.  The type of this numeric argument is an unsigned
820integer type with the property that any valid pointer to void can be converted
821to this type and then converted back to a pointer to void.  The result will
822compare equal to the original pointer.
823
824**NOTES:**
825
826The calling task will be preempted if its preemption mode is
827enabled and the task being started has a higher priority.
828
829Any actions performed on a dormant task such as suspension or
830change of priority are nullified when the task is initiated via
831the ``rtems.task_start`` directive.
832
833TASK_RESTART - Restart a task
834-----------------------------
835.. index:: restarting a task
836
837**CALLING SEQUENCE:**
838
839.. code:: c
840
841    procedure Task_Restart (
842    ID       : in     RTEMS.ID;
843    Argument : in     RTEMS.Task_Argument;
844    Result   :    out RTEMS.Status_Codes
845    );
846
847**DIRECTIVE STATUS CODES:**
848
849``RTEMS.SUCCESSFUL`` - task restarted successfully
850``RTEMS.INVALID_ID`` - task id invalid
851``RTEMS.INCORRECT_STATE`` - task never started
852``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - cannot restart remote task
853
854**DESCRIPTION:**
855
856This directive resets the task specified by id to begin
857execution at its original starting address.  The task’s priority
858and execution mode are set to the original creation values.  If
859the task is currently blocked, RTEMS automatically makes the
860task ready.  A task can be restarted from any state, except the
861dormant state.
862
863The task’s starting argument is contained in argument.  This argument can be a
864single value or an index into an array of parameter blocks.  The type of this
865numeric argument is an unsigned integer type with the property that any valid
866pointer to void can be converted to this type and then converted back to a
867pointer to void.  The result will compare equal to the original pointer.  This
868new argument may be used to distinguish
869between the initial ``rtems.task_start``
870of the task and any ensuing calls
871to ``rtems.task_restart``
872of the task.  This can be beneficial in deleting
873a task.  Instead of deleting a task using
874the ``rtems.task_delete``
875directive, a task can delete another task by restarting that
876task, and allowing that task to release resources back to RTEMS
877and then delete itself.
878
879**NOTES:**
880
881If id is ``RTEMS.SELF``, the calling task will be restarted and will not
882return from this directive.
883
884The calling task will be preempted if its preemption mode is
885enabled and the task being restarted has a higher priority.
886
887The task must reside on the local node, even if the task was
888created with the ``RTEMS.GLOBAL`` option.
889
890TASK_DELETE - Delete a task
891---------------------------
892.. index:: deleting a task
893
894**CALLING SEQUENCE:**
895
896.. code:: c
897
898    procedure Task_Delete (
899    ID     : in     RTEMS.ID;
900    Result :    out RTEMS.Status_Codes
901    );
902
903**DIRECTIVE STATUS CODES:**
904
905``RTEMS.SUCCESSFUL`` - task deleted successfully
906``RTEMS.INVALID_ID`` - task id invalid
907``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - cannot restart remote task
908
909**DESCRIPTION:**
910
911This directive deletes a task, either the calling task or
912another task, as specified by id.  RTEMS stops the execution of
913the task and reclaims the stack memory, any allocated delay or
914timeout timers, the TCB, and, if the task is ``RTEMS.FLOATING_POINT``, its
915floating point context area.  RTEMS does not reclaim the
916following resources: region segments, partition buffers,
917semaphores, timers, or rate monotonic periods.
918
919**NOTES:**
920
921A task is responsible for releasing its resources back to RTEMS
922before deletion.  To insure proper deallocation of resources, a
923task should not be deleted unless it is unable to execute or
924does not hold any RTEMS resources.  If a task holds RTEMS
925resources, the task should be allowed to deallocate its
926resources before deletion.  A task can be directed to release
927its resources and delete itself by restarting it with a special
928argument or by sending it a message, an event, or a signal.
929
930Deletion of the current task (``RTEMS.SELF``) will force RTEMS to select
931another task to execute.
932
933When a global task is deleted, the task id must be transmitted
934to every node in the system for deletion from the local copy of
935the global object table.
936
937The task must reside on the local node, even if the task was
938created with the ``RTEMS.GLOBAL`` option.
939
940TASK_SUSPEND - Suspend a task
941-----------------------------
942.. index:: suspending a task
943
944**CALLING SEQUENCE:**
945
946.. code:: c
947
948    procedure Task_Suspend (
949    ID     : in     RTEMS.ID;
950    Result :    out RTEMS.Status_Codes
951    );
952
953**DIRECTIVE STATUS CODES:**
954
955``RTEMS.SUCCESSFUL`` - task suspended successfully
956``RTEMS.INVALID_ID`` - task id invalid
957``RTEMS.ALREADY_SUSPENDED`` - task already suspended
958
959**DESCRIPTION:**
960
961This directive suspends the task specified by id from further
962execution by placing it in the suspended state.  This state is
963additive to any other blocked state that the task may already be
964in.  The task will not execute again until another task issues
965the ``rtems.task_resume``
966directive for this task and any blocked state
967has been removed.
968
969**NOTES:**
970
971The requesting task can suspend itself by specifying ``RTEMS.SELF`` as id.
972In this case, the task will be suspended and a successful
973return code will be returned when the task is resumed.
974
975Suspending a global task which does not reside on the local node
976will generate a request to the remote node to suspend the
977specified task.
978
979If the task specified by id is already suspended, then the``RTEMS.ALREADY_SUSPENDED`` status code is returned.
980
981TASK_RESUME - Resume a task
982---------------------------
983.. index:: resuming a task
984
985**CALLING SEQUENCE:**
986
987.. code:: c
988
989    procedure Task_Resume (
990    ID     : in     RTEMS.ID;
991    Result :    out RTEMS.Status_Codes
992    );
993
994**DIRECTIVE STATUS CODES:**
995
996``RTEMS.SUCCESSFUL`` - task resumed successfully
997``RTEMS.INVALID_ID`` - task id invalid
998``RTEMS.INCORRECT_STATE`` - task not suspended
999
1000**DESCRIPTION:**
1001
1002This directive removes the task specified by id from the
1003suspended state.  If the task is in the ready state after the
1004suspension is removed, then it will be scheduled to run.  If the
1005task is still in a blocked state after the suspension is
1006removed, then it will remain in that blocked state.
1007
1008**NOTES:**
1009
1010The running task may be preempted if its preemption mode is
1011enabled and the local task being resumed has a higher priority.
1012
1013Resuming a global task which does not reside on the local node
1014will generate a request to the remote node to resume the
1015specified task.
1016
1017If the task specified by id is not suspended, then the``RTEMS.INCORRECT_STATE`` status code is returned.
1018
1019TASK_IS_SUSPENDED - Determine if a task is Suspended
1020----------------------------------------------------
1021.. index:: is task suspended
1022
1023**CALLING SEQUENCE:**
1024
1025.. code:: c
1026
1027    procedure Task_Is_Suspended (
1028    ID     : in     RTEMS.ID;
1029    Result :    out RTEMS.Status_Codes
1030    );
1031
1032**DIRECTIVE STATUS CODES:**
1033
1034``RTEMS.SUCCESSFUL`` - task is NOT suspended
1035``RTEMS.ALREADY_SUSPENDED`` - task is currently suspended
1036``RTEMS.INVALID_ID`` - task id invalid
1037``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - not supported on remote tasks
1038
1039**DESCRIPTION:**
1040
1041This directive returns a status code indicating whether or
1042not the specified task is currently suspended.
1043
1044**NOTES:**
1045
1046This operation is not currently supported on remote tasks.
1047
1048TASK_SET_PRIORITY - Set task priority
1049-------------------------------------
1050.. index:: rtems_task_set_priority
1051.. index:: current task priority
1052.. index:: set task priority
1053.. index:: get task priority
1054.. index:: obtain task priority
1055
1056**CALLING SEQUENCE:**
1057
1058.. code:: c
1059
1060    procedure Task_Set_Priority (
1061    ID           : in     RTEMS.ID;
1062    New_Priority : in     RTEMS.Task_Priority;
1063    Old_Priority :    out RTEMS.Task_Priority;
1064    Result       :    out RTEMS.Status_Codes
1065    );
1066
1067**DIRECTIVE STATUS CODES:**
1068
1069``RTEMS.SUCCESSFUL`` - task priority set successfully
1070``RTEMS.INVALID_ID`` - invalid task id
1071``RTEMS.INVALID_ADDRESS`` - invalid return argument pointer
1072``RTEMS.INVALID_PRIORITY`` - invalid task priority
1073
1074**DESCRIPTION:**
1075
1076This directive manipulates the priority of the task specified by
1077id.  An id of ``RTEMS.SELF`` is used to indicate
1078the calling task.  When new_priority is not equal to``RTEMS.CURRENT_PRIORITY``, the specified
1079task’s previous priority is returned in old_priority.  When
1080new_priority is ``RTEMS.CURRENT_PRIORITY``,
1081the specified task’s current
1082priority is returned in old_priority.  Valid priorities range
1083from a high of 1 to a low of 255.
1084
1085**NOTES:**
1086
1087The calling task may be preempted if its preemption mode is
1088enabled and it lowers its own priority or raises another task’s
1089priority.
1090
1091In case the new priority equals the current priority of the task, then nothing
1092happens.
1093
1094Setting the priority of a global task which does not reside on
1095the local node will generate a request to the remote node to
1096change the priority of the specified task.
1097
1098If the task specified by id is currently holding any binary
1099semaphores which use the priority inheritance algorithm, then
1100the task’s priority cannot be lowered immediately.  If the
1101task’s priority were lowered immediately, then priority
1102inversion results.  The requested lowering of the task’s
1103priority will occur when the task has released all priority
1104inheritance binary semaphores.  The task’s priority can be
1105increased regardless of the task’s use of priority inheritance
1106binary semaphores.
1107
1108TASK_MODE - Change the current task mode
1109----------------------------------------
1110.. index:: current task mode
1111.. index:: set task mode
1112.. index:: get task mode
1113.. index:: set task preemption mode
1114.. index:: get task preemption mode
1115.. index:: obtain task mode
1116
1117**CALLING SEQUENCE:**
1118
1119.. code:: c
1120
1121    procedure Task_Mode (
1122    Mode_Set          : in     RTEMS.Mode;
1123    Mask              : in     RTEMS.Mode;
1124    Previous_Mode_Set : in     RTEMS.Mode;
1125    Result            :    out RTEMS.Status_Codes
1126    );
1127
1128**DIRECTIVE STATUS CODES:**
1129
1130``RTEMS.SUCCESSFUL`` - task mode set successfully
1131``RTEMS.INVALID_ADDRESS`` - ``previous_mode_set`` is NULL
1132
1133**DESCRIPTION:**
1134
1135This directive manipulates the execution mode of the calling
1136task.  A task’s execution mode enables and disables preemption,
1137timeslicing, asynchronous signal processing, as well as
1138specifying the current interrupt level.  To modify an execution
1139mode, the mode class(es) to be changed must be specified in the
1140mask parameter and the desired mode(s) must be specified in the
1141mode parameter.
1142
1143**NOTES:**
1144
1145The calling task will be preempted if it enables preemption and
1146a higher priority task is ready to run.
1147
1148Enabling timeslicing has no effect if preemption is disabled.  For
1149a task to be timesliced, that task must have both preemption and
1150timeslicing enabled.
1151
1152A task can obtain its current execution mode, without modifying
1153it, by calling this directive with a mask value of``RTEMS.CURRENT_MODE``.
1154
1155To temporarily disable the processing of a valid ASR, a task
1156should call this directive with the ``RTEMS.NO_ASR``
1157indicator specified in mode.
1158
1159The set of task mode constants and each mode’s corresponding
1160mask constant is provided in the following table:
1161
1162- ``RTEMS.PREEMPT`` is masked by``RTEMS.PREEMPT_MASK`` and enables preemption
1163
1164- ``RTEMS.NO_PREEMPT`` is masked by``RTEMS.PREEMPT_MASK`` and disables preemption
1165
1166- ``RTEMS.NO_TIMESLICE`` is masked by``RTEMS.TIMESLICE_MASK`` and disables timeslicing
1167
1168- ``RTEMS.TIMESLICE`` is masked by``RTEMS.TIMESLICE_MASK`` and enables timeslicing
1169
1170- ``RTEMS.ASR`` is masked by``RTEMS.ASR_MASK`` and enables ASR processing
1171
1172- ``RTEMS.NO_ASR`` is masked by``RTEMS.ASR_MASK`` and disables ASR processing
1173
1174- ``RTEMS.INTERRUPT_LEVEL(0)`` is masked by``RTEMS.INTERRUPT_MASK`` and enables all interrupts
1175
1176- ``RTEMS.INTERRUPT_LEVEL(n)`` is masked by``RTEMS.INTERRUPT_MASK`` and sets interrupts level n
1177
1178TASK_WAKE_AFTER - Wake up after interval
1179----------------------------------------
1180.. index:: delay a task for an interval
1181.. index:: wake up after an interval
1182
1183**CALLING SEQUENCE:**
1184
1185.. code:: c
1186
1187    procedure Task_Wake_After (
1188    Ticks  : in     RTEMS.Interval;
1189    Result :    out RTEMS.Status_Codes
1190    );
1191
1192**DIRECTIVE STATUS CODES:**
1193
1194``RTEMS.SUCCESSFUL`` - always successful
1195
1196**DESCRIPTION:**
1197
1198This directive blocks the calling task for the specified number
1199of system clock ticks.  When the requested interval has elapsed,
1200the task is made ready.  The ``rtems.clock_tick``
1201directive automatically updates the delay period.
1202
1203**NOTES:**
1204
1205Setting the system date and time with the``rtems.clock_set`` directive
1206has no effect on a ``rtems.task_wake_after`` blocked task.
1207
1208A task may give up the processor and remain in the ready state
1209by specifying a value of ``RTEMS.YIELD_PROCESSOR`` in ticks.
1210
1211The maximum timer interval that can be specified is the maximum
1212value which can be represented by the uint32_t type.
1213
1214A clock tick is required to support the functionality of this directive.
1215
1216TASK_WAKE_WHEN - Wake up when specified
1217---------------------------------------
1218.. index:: delay a task until a wall time
1219.. index:: wake up at a wall time
1220
1221**CALLING SEQUENCE:**
1222
1223.. code:: c
1224
1225    procedure Task_Wake_When (
1226    Time_Buffer : in     RTEMS.Time_Of_Day;
1227    Result      :    out RTEMS.Status_Codes
1228    );
1229
1230**DIRECTIVE STATUS CODES:**
1231
1232``RTEMS.SUCCESSFUL`` - awakened at date/time successfully
1233``RTEMS.INVALID_ADDRESS`` - ``time_buffer`` is NULL
1234``RTEMS.INVALID_TIME_OF_DAY`` - invalid time buffer
1235``RTEMS.NOT_DEFINED`` - system date and time is not set
1236
1237**DESCRIPTION:**
1238
1239This directive blocks a task until the date and time specified
1240in time_buffer.  At the requested date and time, the calling
1241task will be unblocked and made ready to execute.
1242
1243**NOTES:**
1244
1245The ticks portion of time_buffer record is ignored.  The
1246timing granularity of this directive is a second.
1247
1248A clock tick is required to support the functionality of this directive.
1249
1250ITERATE_OVER_ALL_THREADS - Iterate Over Tasks
1251---------------------------------------------
1252.. index:: iterate over all threads
1253
1254**CALLING SEQUENCE:**
1255
1256.. code:: c
1257
1258    NOT SUPPORTED FROM Ada BINDING
1259
1260**DIRECTIVE STATUS CODES: NONE**
1261
1262**DESCRIPTION:**
1263
1264This directive iterates over all of the existant threads in the
1265system and invokes ``routine`` on each of them.  The user should
1266be careful in accessing the contents of ``the_thread``.
1267
1268This routine is intended for use in diagnostic utilities and is
1269not intented for routine use in an operational system.
1270
1271**NOTES:**
1272
1273There is NO protection while this routine is called.  Thus it is
1274possible that ``the_thread`` could be deleted while this is operating.
1275By not having protection, the user is free to invoke support routines
1276from the C Library which require semaphores for data structures.
1277
1278TASK_VARIABLE_ADD - Associate per task variable
1279-----------------------------------------------
1280.. index:: per-task variable
1281.. index:: task private variable
1282.. index:: task private data
1283
1284**CALLING SEQUENCE:**
1285
1286.. code:: c
1287
1288    type Task_Variable_Dtor is access procedure (
1289    Argument : in     RTEMS.Address;
1290    );
1291    procedure Task_Variable_Add (
1292    ID            : in     RTEMS.ID;
1293    Task_Variable : in     RTEMS.Address;
1294    Dtor          : in     RTEMS.Task_Variable_Dtor;
1295    Result        :    out RTEMS.Status_Codes
1296    );
1297
1298**DIRECTIVE STATUS CODES:**
1299
1300``RTEMS.SUCCESSFUL`` - per task variable added successfully
1301``RTEMS.INVALID_ADDRESS`` - ``task_variable`` is NULL
1302``RTEMS.INVALID_ID`` - invalid task id
1303``RTEMS.NO_MEMORY`` - invalid task id
1304``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - not supported on remote tasks
1305
1306**DESCRIPTION:**
1307
1308This directive adds the memory location specified by the
1309ptr argument to the context of the given task.  The variable will
1310then be private to the task.  The task can access and modify the
1311variable, but the modifications will not appear to other tasks, and
1312other tasks’ modifications to that variable will not affect the value
1313seen by the task.  This is accomplished by saving and restoring the
1314variable’s value each time a task switch occurs to or from the calling task.
1315If the dtor argument is non-NULL it specifies the address of a ‘destructor’
1316function which will be called when the task is deleted.  The argument
1317passed to the destructor function is the task’s value of the variable.
1318
1319**NOTES:**
1320
1321This directive is deprecated and task variables will be removed.
1322
1323Task variables increase the context switch time to and from the
1324tasks that own them so it is desirable to minimize the number of
1325task variables.  One efficient method
1326is to have a single task variable that is a pointer to a dynamically
1327allocated structure containing the task’s private ‘global’ data.
1328In this case the destructor function could be ‘free’.
1329
1330Per-task variables are disabled in SMP configurations and this service
1331is not available.
1332
1333TASK_VARIABLE_GET - Obtain value of a per task variable
1334-------------------------------------------------------
1335.. index:: get per-task variable
1336.. index:: obtain per-task variable
1337
1338**CALLING SEQUENCE:**
1339
1340.. code:: c
1341
1342    procedure Task_Variable_Get (
1343    ID                  : in     RTEMS.ID;
1344    Task_Variable       :    out RTEMS.Address;
1345    Task_Variable_Value :    out RTEMS.Address;
1346    Result              :    out RTEMS.Status_Codes
1347    );
1348
1349**DIRECTIVE STATUS CODES:**
1350
1351``RTEMS.SUCCESSFUL`` - per task variable obtained successfully
1352``RTEMS.INVALID_ADDRESS`` - ``task_variable`` is NULL
1353``RTEMS.INVALID_ADDRESS`` - ``task_variable_value`` is NULL
1354``RTEMS.INVALID_ADDRESS`` - ``task_variable`` is not found
1355``RTEMS.NO_MEMORY`` - invalid task id
1356``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - not supported on remote tasks
1357
1358**DESCRIPTION:**
1359
1360This directive looks up the private value of a task variable for a
1361specified task and stores that value in the location pointed to by
1362the result argument.  The specified task is usually not the calling
1363task, which can get its private value by directly accessing the variable.
1364
1365**NOTES:**
1366
1367This directive is deprecated and task variables will be removed.
1368
1369If you change memory which ``task_variable_value`` points to,
1370remember to declare that memory as volatile, so that the compiler
1371will optimize it correctly.  In this case both the pointer``task_variable_value`` and data referenced by ``task_variable_value``
1372should be considered volatile.
1373
1374Per-task variables are disabled in SMP configurations and this service
1375is not available.
1376
1377TASK_VARIABLE_DELETE - Remove per task variable
1378-----------------------------------------------
1379.. index:: per-task variable
1380.. index:: task private variable
1381.. index:: task private data
1382
1383**CALLING SEQUENCE:**
1384
1385.. code:: c
1386
1387    procedure Task_Variable_Delete (
1388    ID                  : in     RTEMS.ID;
1389    Task_Variable       :    out RTEMS.Address;
1390    Result              :    out RTEMS.Status_Codes
1391    );
1392
1393**DIRECTIVE STATUS CODES:**
1394
1395``RTEMS.SUCCESSFUL`` - per task variable deleted successfully
1396``RTEMS.INVALID_ID`` - invalid task id
1397``RTEMS.NO_MEMORY`` - invalid task id
1398``RTEMS.INVALID_ADDRESS`` - ``task_variable`` is NULL
1399``RTEMS.ILLEGAL_ON_REMOTE_OBJECT`` - not supported on remote tasks
1400
1401**DESCRIPTION:**
1402
1403This directive removes the given location from a task’s context.
1404
1405**NOTES:**
1406
1407This directive is deprecated and task variables will be removed.
1408
1409Per-task variables are disabled in SMP configurations and this service
1410is not available.
1411
1412.. COMMENT: COPYRIGHT (c) 1988-2008.
1413
1414.. COMMENT: On-Line Applications Research Corporation (OAR).
1415
1416.. COMMENT: All rights reserved.
1417
Note: See TracBrowser for help on using the repository browser.