mirror of
https://git.rtems.org/rtems-docs/
synced 2025-05-15 01:56:39 +08:00
parent
ac61465d2c
commit
8bd4e6a55b
@ -683,6 +683,8 @@ The withdraw operation takes away scheduler nodes once the thread is no longer
|
|||||||
allowed to use them, e.g. it released a mutex. The availability of scheduler
|
allowed to use them, e.g. it released a mutex. The availability of scheduler
|
||||||
nodes for a thread is controlled by the thread queues.
|
nodes for a thread is controlled by the thread queues.
|
||||||
|
|
||||||
|
.. _SMPThreadDispatchDetails:
|
||||||
|
|
||||||
Thread Dispatch Details
|
Thread Dispatch Details
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
@ -261,9 +261,7 @@ destructors and thread-local object destructors run in this context.
|
|||||||
Thread Switch Extension
|
Thread Switch Extension
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
The thread switch extension is invoked before the context switch from the
|
The thread switch extension is defined as follows.
|
||||||
currently executing thread to the heir thread. The thread switch extension is
|
|
||||||
defined as follows.
|
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
@ -272,18 +270,34 @@ defined as follows.
|
|||||||
rtems_tcb *heir
|
rtems_tcb *heir
|
||||||
);
|
);
|
||||||
|
|
||||||
The :c:data:`executing` is a pointer to the TCB of the currently executing
|
The invocation conditions of the thread switch extension depend on whether RTEMS
|
||||||
thread. The :c:data:`heir` is a pointer to the TCB of the heir thread.
|
was configured for uniprocessor or SMP systems. A user must pay attention to
|
||||||
|
the differences to correctly implement a thread switch extension.
|
||||||
|
|
||||||
|
In uniprocessor configurations, the thread switch extension is invoked before
|
||||||
|
the context switch from the currently executing thread to the heir thread. The
|
||||||
|
:c:data:`executing` is a pointer to the TCB of the currently executing thread.
|
||||||
|
The :c:data:`heir` is a pointer to the TCB of the heir thread. The context
|
||||||
|
switch initiated through the multitasking start is not covered by the thread
|
||||||
|
switch extension.
|
||||||
|
|
||||||
|
In SMP configurations, the thread switch extension is invoked after the context
|
||||||
|
switch to the new executing thread (previous heir thread). The
|
||||||
|
:c:data:`executing` is a pointer to the TCB of the previously executing thread.
|
||||||
|
Despite the name, this is not the currently executing thread. The
|
||||||
|
:c:data:`heir` is a pointer to the TCB of the newly executing thread. This is
|
||||||
|
the currently executing thread. The context switches initiated through the
|
||||||
|
multitasking start are covered by the thread switch extension. The reason for
|
||||||
|
the differences to uniprocessor configurations is that the context switch may
|
||||||
|
update the heir thread of the processor, see :ref:`SMPThreadDispatchDetails`.
|
||||||
|
The thread switch extensions are invoked with disabled interrupts and with
|
||||||
|
ownership of a per-processor SMP lock. Thread switch extensions may run in
|
||||||
|
parallel on multiple processors. It is recommended to use thread-local or
|
||||||
|
per-processor data structures for thread switch extensions. A global SMP lock
|
||||||
|
should be avoided for performance reasons.
|
||||||
|
|
||||||
The thread switch extension is invoked in forward order with thread dispatching
|
The thread switch extension is invoked in forward order with thread dispatching
|
||||||
disabled. In SMP configurations, interrupts are disabled and the per-processor
|
disabled.
|
||||||
SMP lock is owned. Thread switch extensions may run in parallel on multiple
|
|
||||||
processors. It is recommended to use thread-local or per-processor data
|
|
||||||
structures in SMP configurations for thread switch extensions. A global SMP
|
|
||||||
lock should be avoided for performance reasons.
|
|
||||||
|
|
||||||
The context switches initiated through the multitasking start are not covered
|
|
||||||
by the thread switch extension.
|
|
||||||
|
|
||||||
.. index:: rtems_task_begin_extension
|
.. index:: rtems_task_begin_extension
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user