RTEMS 6.3
Loading...
Searching...
No Matches
threadq.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12
13/*
14 * COPYRIGHT (c) 1989-2014.
15 * On-Line Applications Research Corporation (OAR).
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _RTEMS_SCORE_THREADQ_H
40#define _RTEMS_SCORE_THREADQ_H
41
42#include <rtems/score/chain.h>
43#include <rtems/score/isrlock.h>
44#include <rtems/score/object.h>
46#include <rtems/score/rbtree.h>
47#include <rtems/score/states.h>
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54struct Per_CPU_Control;
55
56struct Scheduler_Node;
57
71
72typedef struct _Thread_Control Thread_Control;
73
75
77
79
91 Thread_queue_Queue *queue,
92 Thread_Control *the_thread,
93 struct Per_CPU_Control *cpu_self,
94 Thread_queue_Context *queue_context
95);
96
105 Thread_Control *the_thread
106);
107
108#if defined(RTEMS_MULTIPROCESSING)
119typedef void ( *Thread_queue_MP_callout )(
120 Thread_Control *the_proxy,
121 Objects_Id mp_id
122);
123#endif
124
125#if defined(RTEMS_SMP)
136typedef struct {
137 Chain_Node Node;
138
139 Atomic_Uint go_ahead;
140} Thread_queue_Gate;
141#endif
142
143typedef struct {
149
150#if defined(RTEMS_SMP)
154 struct {
160 Thread_queue_Gate Gate;
161
165 Thread_queue_Queue *queue;
166 } Wait;
167#endif
169
170#if defined(RTEMS_SMP)
175typedef struct {
180 RBTree_Node Registry_node;
181
185 Thread_queue_Queue *source;
186
191 Thread_queue_Queue *target;
192
196 Chain_Node Path_node;
197
201 Thread_Control *owner;
202
207 Thread_queue_Lock_context Lock_context;
208} Thread_queue_Link;
209#endif
210
222
227
241
247 union {
252
256 const void *arg;
257 } Timeout;
258
264
265#if defined(RTEMS_SMP)
276 struct {
280 Chain_Control Links;
281
285 Thread_queue_Link Start;
286
291 Thread_queue_Link Deadlock;
292 } Path;
293#endif
294
299 struct {
304
309 size_t update_count;
310
318 Thread_Control *update[ 2 ];
319 } Priority;
320
330
331#if defined(RTEMS_MULTIPROCESSING)
342 Thread_queue_MP_callout mp_callout;
343#endif
344};
345
349typedef struct {
350#if defined(RTEMS_SMP)
357 Chain_Node Node;
358#endif
359
364
371
385typedef struct _Thread_queue_Heads {
389 union {
398
399#if !defined(RTEMS_SMP)
404#endif
405 } Heads;
406
412
418
419#if defined(RTEMS_SMP)
424#endif
426
428#if defined(RTEMS_SMP)
441 SMP_ticket_lock_Control Lock;
442#endif
443
452
456 Thread_Control *owner;
457
461 const char *name;
462};
463
474 Thread_queue_Queue *queue,
475 Priority_Actions *priority_actions
476);
477
489 Thread_queue_Queue *queue,
490 Thread_Control *the_thread,
491 Thread_queue_Context *queue_context
492);
493
501 Thread_queue_Queue *queue,
502 Thread_Control *the_thread,
503 Thread_queue_Context *queue_context
504);
505
517typedef Thread_Control *( *Thread_queue_Surrender_operation )(
518 Thread_queue_Queue *queue,
519 Thread_queue_Heads *heads,
520 Thread_Control *previous_owner,
521 Thread_queue_Context *queue_context
522);
523
534typedef Thread_Control *( *Thread_queue_First_operation )(
535 const Thread_queue_Heads *heads
536);
537
604
609typedef struct {
610#if defined(RTEMS_SMP)
611#if defined(RTEMS_DEBUG)
623 uint32_t owner;
624#endif
625
626#if defined(RTEMS_PROFILING)
633 SMP_lock_Stats Lock_stats;
634#endif
635#endif
636
642
644
645#ifdef __cplusplus
646}
647#endif
648
649#endif
650/* end of include file */
#define RTEMS_ZERO_LENGTH_ARRAY
This constant represents the element count of a zero-length array.
Definition basedefs.h:1032
uint32_t Objects_Id
Definition object.h:101
uint32_t States_Control
Definition states.h:65
void(*) Thread_queue_Enqueue_callout(Thread_queue_Queue *queue, Thread_Control *the_thread, struct Per_CPU_Control *cpu_self, Thread_queue_Context *queue_context)
Thread queue enqueue callout.
Definition threadq.h:90
void(*) Thread_queue_Extract_operation(Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Thread queue extract operation.
Definition threadq.h:500
void(*) Thread_queue_Priority_actions_operation(Thread_queue_Queue *queue, Priority_Actions *priority_actions)
Thread queue action operation.
Definition threadq.h:473
Thread_Control *(*) Thread_queue_First_operation(const Thread_queue_Heads *heads)
Gets the first thread on the queue.
Definition threadq.h:534
struct _Thread_queue_Heads Thread_queue_Heads
Thread queue heads.
void(*) Thread_queue_Deadlock_callout(Thread_Control *the_thread)
Thread queue deadlock callout.
Definition threadq.h:104
void(*) Thread_queue_Enqueue_operation(Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Thread queue enqueue operation.
Definition threadq.h:488
Thread_Control *(*) Thread_queue_Surrender_operation(Thread_queue_Queue *queue, Thread_queue_Heads *heads, Thread_Control *previous_owner, Thread_queue_Context *queue_context)
Thread queue surrender operation.
Definition threadq.h:517
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition watchdogticks.h:59
This header file provides the interfaces of the ISR Locks.
This header file provides interfaces of the Priority Handler which are used by the implementation and...
This header file provides interfaces of the Red-Black Tree Handler which are used by the implementati...
This header file provides interfaces of the Chain Handler which are used by the implementation and th...
This header file provides interfaces of the Object Handler which are used by the implementation and t...
This header file provides interfaces of the Thread States which are used by the implementation and th...
This structure represents a chain node.
Definition chain.h:78
Local ISR lock context for acquire and release pairs.
Definition isrlock.h:94
Per CPU Core Structure.
Definition percpu.h:384
A list of priority actions.
Definition priority.h:207
The priority aggregation.
Definition priority.h:147
Red-black tree node.
Definition rbtree.h:73
Scheduler node for per-thread data.
Definition schedulernode.h:94
Priority_Actions Actions
A priority action list.
Thread_Control * update[2]
Threads to update the priority via _Thread_Priority_update().
size_t update_count
Count of threads to update the priority via _Thread_Priority_update().
Thread queue context for the thread queue methods.
Definition threadq.h:216
Thread_queue_Enqueue_callout enqueue_callout
The enqueue callout for _Thread_queue_Enqueue().
Definition threadq.h:240
Thread_queue_Deadlock_callout deadlock_callout
Invoked in case of a detected deadlock.
Definition threadq.h:329
bool timeout_absolute
If this member is true, the timeout shall be absolute, otherwise it shall be relative to the current ...
Definition threadq.h:263
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition threadq.h:221
States_Control thread_state
The thread state for _Thread_queue_Enqueue().
Definition threadq.h:226
Definition threadq.h:609
Thread_queue_Queue Queue
The actual thread queue.
Definition threadq.h:640
Definition threadq.h:143
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition threadq.h:148
The thread queue operations are used to manage the threads of a thread queue.
Definition threadq.h:554
Thread_queue_Surrender_operation surrender
This operation is used to dequeue the thread from the thread queue and optionally surrender the threa...
Definition threadq.h:593
Thread_queue_First_operation first
This operation returns the first thread on the thread queue.
Definition threadq.h:602
Thread_queue_Extract_operation extract
This operation is used to extract the thread from the thread queue.
Definition threadq.h:580
Thread_queue_Enqueue_operation enqueue
This operation is used to enqueue the thread on the thread queue.
Definition threadq.h:568
Thread_queue_Priority_actions_operation priority_actions
This operation performs the thread queue priority actions.
Definition threadq.h:561
Thread priority queue.
Definition threadq.h:349
struct Scheduler_Node * scheduler_node
This priority queue is added to a scheduler node of the owner in case of priority inheritance.
Definition threadq.h:369
Priority_Aggregation Queue
The actual thread priority queue.
Definition threadq.h:363
Definition threadq.h:427
const char * name
The thread queue name.
Definition threadq.h:461
Thread_queue_Heads * heads
The thread queue heads.
Definition threadq.h:451
Thread_Control * owner
The thread queue owner.
Definition threadq.h:456
Definition thread.h:837
Thread queue heads.
Definition threadq.h:385
Chain_Node Free_node
A chain node to add these thread queue heads to the free chain of the thread queue heads dedicated to...
Definition threadq.h:417
Chain_Control Free_chain
A chain with free thread queue heads providing the spare thread queue heads for a thread once it is d...
Definition threadq.h:411
This union represents a chain control block.
Definition chain.h:96
const void * arg
The timeout argument, e.g. pointer to struct timespec.
Watchdog_Interval ticks
The timeout in ticks.
Chain_Control Fifo
This is the FIFO discipline list.
Thread_queue_Priority_queue Priority
This is the set of threads for priority discipline waiting.
This header file provides the interfaces of the Watchdog Handler related to watchdog ticks which are ...