RTEMS 7.0-rc1
Loading...
Searching...
No Matches
threadq.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
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#include <sys/types.h>
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55struct Per_CPU_Control;
56
57struct Scheduler_Node;
58
73typedef struct _Thread_Control Thread_Control;
74
76
78
80
92 Thread_queue_Queue *queue,
93 Thread_Control *the_thread,
94 struct Per_CPU_Control *cpu_self,
95 Thread_queue_Context *queue_context
96);
97
106 Thread_Control *the_thread
107);
108
109#if defined(RTEMS_MULTIPROCESSING)
120typedef void ( *Thread_queue_MP_callout )(
121 Thread_Control *the_proxy,
122 Objects_Id mp_id
123);
124#endif
125
126#if defined(RTEMS_SMP)
137typedef struct {
138 Chain_Node Node;
139
140 Atomic_Uint go_ahead;
141} Thread_queue_Gate;
142#endif
143
144typedef struct {
150
151#if defined(RTEMS_SMP)
155 struct {
161 Thread_queue_Gate Gate;
162
166 Thread_queue_Queue *queue;
167 } Wait;
168#endif
170
171#if defined(RTEMS_SMP)
176typedef struct {
181 RBTree_Node Registry_node;
182
186 Thread_queue_Queue *source;
187
192 Thread_queue_Queue *target;
193
197 Chain_Node Path_node;
198
202 Thread_Control *owner;
203
208 Thread_queue_Lock_context Lock_context;
209} Thread_queue_Link;
210#endif
211
223
228
242
248 union {
253
257 const void *arg;
259
265
272 clockid_t clock_id;
273
274#if defined(RTEMS_SMP)
285 struct {
289 Chain_Control Links;
290
294 Thread_queue_Link Start;
295
300 Thread_queue_Link Deadlock;
301 } Path;
302#endif
303
308 struct {
313
319
329
339
340#if defined(RTEMS_MULTIPROCESSING)
351 Thread_queue_MP_callout mp_callout;
352#endif
353};
354
358typedef struct {
359#if defined(RTEMS_SMP)
366 Chain_Node Node;
367#endif
368
373
380
394typedef struct _Thread_queue_Heads {
398 union {
407
408#if !defined(RTEMS_SMP)
413#endif
415
421
427
428#if defined(RTEMS_SMP)
433#endif
435
437#if defined(RTEMS_SMP)
450 SMP_ticket_lock_Control Lock;
451#endif
452
461
466
470 const char *name;
471};
472
483 Thread_queue_Queue *queue,
484 Priority_Actions *priority_actions
485);
486
498 Thread_queue_Queue *queue,
499 Thread_Control *the_thread,
500 Thread_queue_Context *queue_context
501);
502
510 Thread_queue_Queue *queue,
511 Thread_Control *the_thread,
512 Thread_queue_Context *queue_context
513);
514
526typedef Thread_Control *( *Thread_queue_Surrender_operation )(
527 Thread_queue_Queue *queue,
528 Thread_queue_Heads *heads,
529 Thread_Control *previous_owner,
530 Thread_queue_Context *queue_context
531);
532
543typedef Thread_Control *( *Thread_queue_First_operation )(
544 const Thread_queue_Heads *heads
545);
546
571
578
590
603
612};
613
618typedef struct {
619#if defined(RTEMS_SMP)
620#if defined(RTEMS_DEBUG)
632 uint32_t owner;
633#endif
634
635#if defined(RTEMS_PROFILING)
642 SMP_lock_Stats Lock_stats;
643#endif
644#endif
645
651
654#ifdef __cplusplus
655}
656#endif
657
658#endif
659/* end of include file */
#define RTEMS_ZERO_LENGTH_ARRAY
This constant represents the element count of a zero-length array.
Definition: basedefs.h:1057
uint32_t Objects_Id
Definition: object.h:101
uint32_t States_Control
Definition: states.h:65
Thread_Control *(* Thread_queue_First_operation)(const Thread_queue_Heads *heads)
Gets the first thread on the queue.
Definition: threadq.h:543
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:526
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:497
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:509
void(* Thread_queue_Priority_actions_operation)(Thread_queue_Queue *queue, Priority_Actions *priority_actions)
Thread queue action operation.
Definition: threadq.h:482
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:91
void(* Thread_queue_Deadlock_callout)(Thread_Control *the_thread)
Thread queue deadlock callout.
Definition: threadq.h:105
struct _Thread_queue_Heads Thread_queue_Heads
Thread queue heads.
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
Thread queue context for the thread queue methods.
Definition: threadq.h:217
Thread_queue_Enqueue_callout enqueue_callout
The enqueue callout for _Thread_queue_Enqueue().
Definition: threadq.h:241
clockid_t clock_id
The clock identifier used for timeout operations.
Definition: threadq.h:272
Thread_queue_Deadlock_callout deadlock_callout
Invoked in case of a detected deadlock.
Definition: threadq.h:338
struct Thread_queue_Context::@4371 Priority
Block to manage thread priority changes due to a thread queue operation.
const void * arg
The timeout argument, e.g. pointer to struct timespec.
Definition: threadq.h:257
size_t update_count
Count of threads to update the priority via _Thread_Priority_update().
Definition: threadq.h:318
bool timeout_absolute
If this member is true, the timeout shall be absolute, otherwise it shall be relative to the current ...
Definition: threadq.h:264
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:222
union Thread_queue_Context::@4370 Timeout
Interval to wait.
Watchdog_Interval ticks
The timeout in ticks.
Definition: threadq.h:252
States_Control thread_state
The thread state for _Thread_queue_Enqueue().
Definition: threadq.h:227
Priority_Actions Actions
A priority action list.
Definition: threadq.h:312
Thread_Control * update[2]
Threads to update the priority via _Thread_Priority_update().
Definition: threadq.h:327
Definition: threadq.h:618
Thread_queue_Queue Queue
The actual thread queue.
Definition: threadq.h:649
Definition: threadq.h:144
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:149
The thread queue operations are used to manage the threads of a thread queue.
Definition: threadq.h:563
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:602
Thread_queue_First_operation first
This operation returns the first thread on the thread queue.
Definition: threadq.h:611
Thread_queue_Extract_operation extract
This operation is used to extract the thread from the thread queue.
Definition: threadq.h:589
Thread_queue_Enqueue_operation enqueue
This operation is used to enqueue the thread on the thread queue.
Definition: threadq.h:577
Thread_queue_Priority_actions_operation priority_actions
This operation performs the thread queue priority actions.
Definition: threadq.h:570
Thread priority queue.
Definition: threadq.h:358
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:378
Priority_Aggregation Queue
The actual thread priority queue.
Definition: threadq.h:372
Definition: threadq.h:436
const char * name
The thread queue name.
Definition: threadq.h:470
Thread_queue_Heads * heads
The thread queue heads.
Definition: threadq.h:460
Thread_Control * owner
The thread queue owner.
Definition: threadq.h:465
Definition: thread.h:837
Thread queue heads.
Definition: threadq.h:394
Chain_Control Fifo
This is the FIFO discipline list.
Definition: threadq.h:406
Thread_queue_Priority_queue Priority
This is the set of threads for priority discipline waiting.
Definition: threadq.h:412
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:426
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:420
union _Thread_queue_Heads::@4372 Heads
This union represents a chain control block.
Definition: chain.h:96
This header file provides the interfaces of the Watchdog Handler related to watchdog ticks which are ...