1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
brief: |
Deletes the task.
copyrights:
- Copyright (C) 2021 embedded brains GmbH & Co. KG
- Copyright (C) 1988, 2017 On-Line Applications Research Corporation (OAR)
definition:
default:
attributes: null
body: null
params:
- ${../../type/if/id:/name} ${.:/params[0]/name}
return: ${../../status/if/code:/name}
variants: []
description: |
This directive deletes the task, either the calling task or another task, as
specified by ${.:/params[0]/name}.
enabled-by: true
index-entries:
- delete a task
interface-type: function
links:
- role: interface-placement
uid: header
- role: interface-ingroup
uid: group
- role: constraint
uid: /constraint/directive-ctx-devinit
- role: constraint
uid: /constraint/directive-ctx-task
- role: constraint
uid: /constraint/object-allocator
- role: constraint
uid: /constraint/mp-send
- role: constraint
uid: ../../constraint/delete-by-any-task
- role: constraint
uid: /constraint/obj-unlimited-free
name: rtems_task_delete
notes: |
The task deletion is done in several steps. Firstly, the task is marked as
terminating. While the task life of the terminating task is protected, it
executes normally until it disables the task life protection or it deletes
itself. A terminating task will eventually stop its normal execution and
start its termination procedure. The procedure executes in the context of
the terminating task. The task termination procedure involves the
destruction of POSIX key values and running the task termination user
extensions. Once complete the execution of the task is stopped and
task-specific resources are reclaimed by the system, such as the stack
memory, any allocated delay or timeout timers, the ${/glossary/tcb:/term},
and, if the task is ${../../attr/if/floating-point:/name}, its floating point
context area. RTEMS explicitly does not reclaim the following resources:
region segments, partition buffers, semaphores, timers, or rate monotonic
periods.
A task is responsible for releasing its resources back to RTEMS before
deletion. To insure proper deallocation of resources, a task should not be
deleted unless it is unable to execute or does not hold any RTEMS resources.
If a task holds RTEMS resources, the task should be allowed to deallocate its
resources before deletion. A task can be directed to release its resources
and delete itself by restarting it with a special argument or by sending it a
message, an event, or a signal.
Deletion of the calling task (${self-define:/name}) will force RTEMS to
select another task to execute.
When a task deletes another task, the calling task waits until the task
termination procedure of the task being deleted has completed. The
terminating task inherits the ${/glossary/priority-eligible:/plural} of the
calling task.
When a global task is deleted, the task identifier must be transmitted to
every node in the system for deletion from the local copy of the global
object table.
The task must reside on the local node, even if the task was created with the
${../../attr/if/global:/name} attribute.
params:
- description: |
is the task identifier. The constant ${self-define:/name} may be used to
specify the calling task.
dir: null
name: id
return:
return: null
return-values:
- description: |
The requested operation was successful.
value: ${../../status/if/successful:/name}
- description: |
There was no task associated with the identifier specified by
${.:/params[0]/name}.
value: ${../../status/if/invalid-id:/name}
- description: |
The directive was called from within interrupt context.
value: ${../../status/if/called-from-isr:/name}
- description: |
The task termination procedure was started, however, waiting for the
terminating task would have resulted in a deadlock.
value: ${../../status/if/incorrect-state:/name}
- description: |
The task resided on a remote node.
value: ${../../status/if/illegal-on-remote-object:/name}
type: interface
|