1 | SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause |
---|
2 | brief: | |
---|
3 | Task switch extensions are invoked when a thread switch from an executing |
---|
4 | thread to a heir thread takes place. |
---|
5 | copyrights: |
---|
6 | - Copyright (C) 2009, 2021 embedded brains GmbH & Co. KG |
---|
7 | definition: |
---|
8 | default: ${/score/userext/if/thread-switch:/name} ${.:/name} |
---|
9 | variants: [] |
---|
10 | description: null |
---|
11 | enabled-by: true |
---|
12 | index-entries: [] |
---|
13 | interface-type: typedef |
---|
14 | links: |
---|
15 | - role: interface-placement |
---|
16 | uid: header |
---|
17 | - role: interface-ingroup |
---|
18 | uid: group |
---|
19 | - role: constraint |
---|
20 | uid: /constraint/thread-dispatching-disabled |
---|
21 | - role: constraint |
---|
22 | uid: /constraint/interrupts-disabled-smp |
---|
23 | name: rtems_task_switch_extension |
---|
24 | notes: | |
---|
25 | The task switch extensions are invoked in |
---|
26 | ${/glossary/extension-forward-order:/term}. |
---|
27 | |
---|
28 | The invocation conditions of the task switch extensions depend on whether |
---|
29 | RTEMS was built with SMP support enabled or disabled. A user must pay |
---|
30 | attention to the differences to correctly implement a task switch extension. |
---|
31 | |
---|
32 | Where the system was built with SMP support disabled, the task switch |
---|
33 | extensions are invoked before the context switch from the currently executing |
---|
34 | thread to the heir thread. The ${.:/params[0]/name} is a pointer to the |
---|
35 | ${/glossary/tcb:/term} of the currently executing thread. The |
---|
36 | ${.:/params[1]/name} is a pointer to the TCB of the heir thread. The context |
---|
37 | switch initiated through the multitasking start is not covered by the task |
---|
38 | switch extensions. |
---|
39 | |
---|
40 | Where the system was built with SMP support enabled, the task switch |
---|
41 | extensions are invoked after the context switch to the heir thread. The |
---|
42 | ${.:/params[0]/name} is a pointer to the TCB of the previously executing |
---|
43 | thread. Despite the name, this is not the currently executing thread. The |
---|
44 | ${.:/params[1]/name} is a pointer to the TCB of the newly executing thread. |
---|
45 | This is the currently executing thread. The context switches initiated |
---|
46 | through the multitasking start are covered by the task switch extensions. |
---|
47 | The reason for the differences to uniprocessor configurations is that the |
---|
48 | context switch may update the heir thread of the processor. The task switch |
---|
49 | extensions are invoked with maskable interrupts disabled and with ownership |
---|
50 | of a processor-specific SMP lock. Task switch extensions may run in parallel |
---|
51 | on multiple processors. It is recommended to use thread-local or |
---|
52 | processor-specific data structures for task switch extensions. A global SMP |
---|
53 | lock should be avoided for performance reasons, see |
---|
54 | ${../../intr/if/lock-initialize:/name}. |
---|
55 | params: |
---|
56 | - description: | |
---|
57 | is the ${/glossary/tcb:/term} of the executing thread. In SMP |
---|
58 | configurations, this is the previously executing thread also known as the |
---|
59 | ancestor thread. |
---|
60 | dir: null |
---|
61 | name: executing |
---|
62 | - description: | |
---|
63 | is the ${/glossary/tcb:/term} of the heir thread. In SMP configurations, |
---|
64 | this is the executing thread. |
---|
65 | dir: null |
---|
66 | name: heir |
---|
67 | return: null |
---|
68 | type: interface |
---|