RTEMS 7.0-rc1
Loading...
Searching...
No Matches
threadqimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 1989-2014.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_SCORE_THREADQIMPL_H
39#define _RTEMS_SCORE_THREADQIMPL_H
40
41#include <rtems/score/threadq.h>
45#include <rtems/score/smp.h>
46#include <rtems/score/status.h>
47#include <rtems/score/thread.h>
49
50#if defined(RTEMS_DEBUG)
51#include <string.h>
52#endif
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
64#define THREAD_QUEUE_LINK_OF_PATH_NODE( node ) \
65 RTEMS_CONTAINER_OF( node, Thread_queue_Link, Path_node );
66
71typedef struct {
72#if !defined(RTEMS_SMP)
73 /*
74 * The struct _Thread_queue_Queue definition is independent of the RTEMS
75 * build configuration. Thus, the storage space for the SMP lock is always
76 * present. In SMP configurations, the SMP lock is contained in the
77 * Thread_queue_Queue.
78 */
79 unsigned int reserved[2];
80#endif
81
84
94 Thread_queue_Queue *queue,
95 Thread_Control *the_thread,
96 Per_CPU_Control *cpu_self,
97 Thread_queue_Context *queue_context
98);
99
109 Thread_queue_Queue *queue,
110 Thread_Control *the_thread,
111 Per_CPU_Control *cpu_self,
112 Thread_queue_Context *queue_context
113);
114
126 Thread_queue_Queue *queue,
127 Thread_Control *the_thread,
128 Per_CPU_Control *cpu_self,
129 Thread_queue_Context *queue_context
130);
131
143 Thread_queue_Queue *queue,
144 Thread_Control *the_thread,
145 Per_CPU_Control *cpu_self,
146 Thread_queue_Context *queue_context
147);
148
159 Thread_queue_Queue *queue,
160 Thread_Control *the_thread,
161 Per_CPU_Control *cpu_self,
162 Thread_queue_Context *queue_context
163);
164
172
179
185static inline void _Thread_queue_Context_initialize(
186 Thread_queue_Context *queue_context
187)
188{
189#if defined(RTEMS_DEBUG)
190 memset( queue_context, 0x7f, sizeof( *queue_context ) );
191#if defined(RTEMS_SMP)
192 _Chain_Initialize_node( &queue_context->Lock_context.Wait.Gate.Node );
193#endif
194 queue_context->enqueue_callout = NULL;
195 queue_context->deadlock_callout = NULL;
196#else
197 (void) queue_context;
198#endif
199}
200
210static inline void
211_Thread_queue_Context_set_thread_state(
212 Thread_queue_Context *queue_context,
213 States_Control thread_state
214)
215{
216 queue_context->thread_state = thread_state;
217}
218
227static inline void
228_Thread_queue_Context_set_timeout_ticks(
229 Thread_queue_Context *queue_context,
231)
232{
233 queue_context->Timeout.ticks = ticks;
234}
235
248static inline void
249_Thread_queue_Context_set_timeout_argument(
250 Thread_queue_Context *queue_context,
251 const void *arg,
252 bool absolute
253)
254{
255 queue_context->Timeout.arg = arg;
256 queue_context->timeout_absolute = absolute;
257}
258
267static inline void
268_Thread_queue_Context_set_enqueue_callout(
269 Thread_queue_Context *queue_context,
270 Thread_queue_Enqueue_callout enqueue_callout
271)
272{
273 queue_context->enqueue_callout = enqueue_callout;
274}
275
283static inline void
284_Thread_queue_Context_set_enqueue_do_nothing_extra(
285 Thread_queue_Context *queue_context
286)
287{
289}
290
300static inline void
301_Thread_queue_Context_set_enqueue_timeout_ticks(
302 Thread_queue_Context *queue_context,
304)
305{
306 queue_context->Timeout.ticks = ticks;
308}
309
323static inline void
324_Thread_queue_Context_set_enqueue_timeout_monotonic_timespec(
325 Thread_queue_Context *queue_context,
326 const struct timespec *timeout,
327 bool absolute
328)
329{
330 queue_context->Timeout.arg = timeout;
331 queue_context->timeout_absolute = absolute;
332 queue_context->enqueue_callout =
334}
335
349static inline void
350_Thread_queue_Context_set_enqueue_timeout_realtime_timespec(
351 Thread_queue_Context *queue_context,
352 const struct timespec *timeout,
353 bool absolute
354)
355{
356 queue_context->Timeout.arg = timeout;
357 queue_context->timeout_absolute = absolute;
359}
360
376static inline void _Thread_queue_Context_set_enqueue_timeout_by_clock_id_timespec(
377 Thread_queue_Context *queue_context,
378 const struct timespec *timeout,
379 bool absolute,
380 clockid_t clock_id
381)
382{
383 queue_context->Timeout.arg = timeout;
384 queue_context->timeout_absolute = absolute;
385 queue_context->clock_id = clock_id;
387}
388
403static inline void _Thread_queue_Context_set_deadlock_callout(
404 Thread_queue_Context *queue_context,
405 Thread_queue_Deadlock_callout deadlock_callout
406)
407{
408 queue_context->deadlock_callout = deadlock_callout;
409}
410
417static inline void _Thread_queue_Context_clear_priority_updates(
418 Thread_queue_Context *queue_context
419)
420{
421 queue_context->Priority.update_count = 0;
422}
423
432static inline size_t _Thread_queue_Context_get_priority_updates(
433 const Thread_queue_Context *queue_context
434)
435{
436 return queue_context->Priority.update_count;
437}
438
446static inline void _Thread_queue_Context_restore_priority_updates(
447 Thread_queue_Context *queue_context,
448 size_t update_count
449)
450{
451 queue_context->Priority.update_count = update_count;
452}
453
462static inline void _Thread_queue_Context_add_priority_update(
463 Thread_queue_Context *queue_context,
464 Thread_Control *the_thread
465)
466{
467 size_t n;
468
469 n = queue_context->Priority.update_count;
470 _Assert( n < RTEMS_ARRAY_SIZE( queue_context->Priority.update ) );
471
472 queue_context->Priority.update_count = n + 1;
473 queue_context->Priority.update[ n ] = the_thread;
474}
475
476#define _Thread_queue_Context_ISR_disable( queue_context, level ) \
477 do { \
478 _ISR_Local_disable( level ); \
479 _ISR_lock_ISR_disable_profile( \
480 &( queue_context )->Lock_context.Lock_context \
481 ) \
482 } while ( 0 )
483
490static inline void _Thread_queue_Context_set_ISR_level(
491 Thread_queue_Context *queue_context,
492 ISR_Level level
493)
494{
495 _ISR_lock_Context_set_level(
496 &queue_context->Lock_context.Lock_context,
497 level
498 );
499}
500
508static inline Per_CPU_Control *_Thread_queue_Dispatch_disable(
509 Thread_queue_Context *queue_context
510)
511{
512 return _Thread_Dispatch_disable_critical(
513 &queue_context->Lock_context.Lock_context
514 );
515}
516
526#if defined(RTEMS_MULTIPROCESSING)
527static inline void _Thread_queue_Context_set_MP_callout(
528 Thread_queue_Context *queue_context,
529 Thread_queue_MP_callout mp_callout
530)
531{
532 queue_context->mp_callout = mp_callout;
533}
534#else
535#define _Thread_queue_Context_set_MP_callout( queue_context, mp_callout ) \
536 do { \
537 (void) queue_context; \
538 } while ( 0 )
539#endif
540
541#if defined(RTEMS_SMP)
547static inline void _Thread_queue_Gate_close(
548 Thread_queue_Gate *gate
549)
550{
551 _Atomic_Store_uint( &gate->go_ahead, 0, ATOMIC_ORDER_RELAXED );
552}
553
560static inline void _Thread_queue_Gate_add(
561 Chain_Control *chain,
562 Thread_queue_Gate *gate
563)
564{
565 _Chain_Append_unprotected( chain, &gate->Node );
566}
567
573static inline void _Thread_queue_Gate_open(
574 Thread_queue_Gate *gate
575)
576{
577 _Atomic_Store_uint( &gate->go_ahead, 1, ATOMIC_ORDER_RELAXED );
578}
579
587static inline void _Thread_queue_Gate_wait(
588 Thread_queue_Gate *gate
589)
590{
591 while ( _Atomic_Load_uint( &gate->go_ahead, ATOMIC_ORDER_RELAXED ) == 0 ) {
592 /* Wait */
593 }
594}
595#endif
596
602static inline void _Thread_queue_Heads_initialize(
603 Thread_queue_Heads *heads
604)
605{
606#if defined(RTEMS_SMP)
607 size_t i;
608
609 for ( i = 0; i < _Scheduler_Count; ++i ) {
610 _Chain_Initialize_node( &heads->Priority[ i ].Node );
611 _Priority_Initialize_empty( &heads->Priority[ i ].Queue );
612 heads->Priority[ i ].Queue.scheduler = &_Scheduler_Table[ i ];
613 }
614#endif
615
616 _Chain_Initialize_empty( &heads->Free_chain );
617 _Chain_Initialize_node( &heads->Free_node );
618}
619
626static inline void _Thread_queue_Queue_initialize(
627 Thread_queue_Queue *queue,
628 const char *name
629)
630{
631#if defined(RTEMS_SMP)
632 _SMP_ticket_lock_Initialize( &queue->Lock );
633#endif
634 queue->heads = NULL;
635 queue->owner = NULL;
636 queue->name = name;
637}
638
646static inline void _Thread_queue_Queue_do_acquire_critical(
647 Thread_queue_Queue *queue,
648#if defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
649 SMP_lock_Stats *lock_stats,
650#endif
651 ISR_lock_Context *lock_context
652)
653{
654#if defined(RTEMS_SMP)
655 (void) lock_context;
656
657 _SMP_ticket_lock_Acquire(
658 &queue->Lock,
659 lock_stats,
660 &lock_context->Lock_context.Stats_context
661 );
662#else
663 (void) queue;
664 (void) lock_context;
665#endif
666}
667
668#if defined(RTEMS_SMP) && defined( RTEMS_PROFILING )
669 #define \
670 _Thread_queue_Queue_acquire_critical( queue, lock_stats, lock_context ) \
671 _Thread_queue_Queue_do_acquire_critical( queue, lock_stats, lock_context )
672#else
673 #define \
674 _Thread_queue_Queue_acquire_critical( queue, lock_stats, lock_context ) \
675 _Thread_queue_Queue_do_acquire_critical( queue, lock_context )
676#endif
677
684static inline void _Thread_queue_Queue_release_critical(
685 Thread_queue_Queue *queue,
686 ISR_lock_Context *lock_context
687)
688{
689#if defined(RTEMS_SMP)
690 (void) lock_context;
691
692 _SMP_ticket_lock_Release(
693 &queue->Lock,
694 &lock_context->Lock_context.Stats_context
695 );
696#else
697 (void) queue;
698 (void) lock_context;
699#endif
700}
701
708static inline void _Thread_queue_Queue_release(
709 Thread_queue_Queue *queue,
710 ISR_lock_Context *lock_context
711)
712{
713 _Thread_queue_Queue_release_critical( queue, lock_context );
714 _ISR_lock_ISR_enable( lock_context );
715}
716
730 const Thread_queue_Queue *queue,
731 char *buffer,
732 size_t buffer_size,
733 Objects_Id *id
734);
735
742#if defined(RTEMS_SMP)
743void _Thread_queue_Do_acquire_critical(
744 Thread_queue_Control *the_thread_queue,
745 ISR_lock_Context *lock_context
746);
747#else
748static inline void _Thread_queue_Do_acquire_critical(
749 Thread_queue_Control *the_thread_queue,
750 ISR_lock_Context *lock_context
751)
752{
753 (void) the_thread_queue;
754 (void) lock_context;
755}
756#endif
757
764static inline void _Thread_queue_Acquire_critical(
765 Thread_queue_Control *the_thread_queue,
766 Thread_queue_Context *queue_context
767)
768{
769 _Thread_queue_Do_acquire_critical(
770 the_thread_queue,
771 &queue_context->Lock_context.Lock_context
772 );
773}
774
781#if defined(RTEMS_SMP)
782void _Thread_queue_Acquire(
783 Thread_queue_Control *the_thread_queue,
784 Thread_queue_Context *queue_context
785);
786#else
787static inline void _Thread_queue_Acquire(
788 Thread_queue_Control *the_thread_queue,
789 Thread_queue_Context *queue_context
790)
791{
792 (void) the_thread_queue;
794}
795#endif
796
805#if defined(RTEMS_DEBUG)
806static inline bool _Thread_queue_Is_lock_owner(
807 const Thread_queue_Control *the_thread_queue
808)
809{
810#if defined(RTEMS_SMP)
811 return the_thread_queue->owner == _SMP_lock_Who_am_I();
812#else
813 (void) the_thread_queue;
814 return _ISR_Get_level() != 0;
815#endif
816}
817#endif
818
825#if defined(RTEMS_SMP)
826void _Thread_queue_Do_release_critical(
827 Thread_queue_Control *the_thread_queue,
828 ISR_lock_Context *lock_context
829);
830#else
831static inline void _Thread_queue_Do_release_critical(
832 Thread_queue_Control *the_thread_queue,
833 ISR_lock_Context *lock_context
834)
835{
836 (void) the_thread_queue;
837 (void) lock_context;
838 _Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) );
839}
840#endif
841
848static inline void _Thread_queue_Release_critical(
849 Thread_queue_Control *the_thread_queue,
850 Thread_queue_Context *queue_context
851)
852{
853 _Thread_queue_Do_release_critical(
854 the_thread_queue,
855 &queue_context->Lock_context.Lock_context
856 );
857}
858
865#if defined(RTEMS_SMP)
866void _Thread_queue_Release(
867 Thread_queue_Control *the_thread_queue,
868 Thread_queue_Context *queue_context
869);
870#else
871static inline void _Thread_queue_Release(
872 Thread_queue_Control *the_thread_queue,
873 Thread_queue_Context *queue_context
874)
875{
876 (void) the_thread_queue;
877 _Assert( _Thread_queue_Is_lock_owner( the_thread_queue ) );
879}
880#endif
881
960 Thread_queue_Queue *queue,
961 const Thread_queue_Operations *operations,
962 Thread_Control *the_thread,
963 Thread_queue_Context *queue_context
964);
965
966#if defined(RTEMS_SMP)
989Status_Control _Thread_queue_Enqueue_sticky(
990 Thread_queue_Queue *queue,
991 const Thread_queue_Operations *operations,
992 Thread_Control *the_thread,
993 Thread_queue_Context *queue_context
994);
995#endif
996
1017 Thread_queue_Queue *queue,
1018 const Thread_queue_Operations *operations,
1019 Thread_Control *the_thread,
1020 Thread_queue_Context *queue_context
1021);
1022
1038 Thread_queue_Queue *queue,
1039 Thread_Control *the_thread,
1040 Thread_queue_Context *queue_context
1041);
1042
1052void _Thread_queue_Extract( Thread_Control *the_thread );
1053
1071 Thread_queue_Queue *queue,
1072 Thread_queue_Heads *heads,
1073 Thread_Control *previous_owner,
1074 Thread_queue_Context *queue_context,
1075 const Thread_queue_Operations *operations
1076);
1077
1093 Thread_queue_Queue *queue,
1094 Thread_queue_Heads *heads,
1095 Thread_queue_Context *queue_context,
1096 const Thread_queue_Operations *operations
1097);
1098
1114 Thread_queue_Queue *queue,
1115 Thread_Control *executing,
1116 Priority_Node *ceiling_priority,
1117 Thread_queue_Context *queue_context,
1118 const Thread_queue_Operations *operations
1119);
1120
1121#if defined(RTEMS_SMP)
1142void _Thread_queue_Surrender_sticky(
1143 Thread_queue_Queue *queue,
1144 Thread_queue_Heads *heads,
1145 Thread_Control *previous_owner,
1146 Thread_queue_Context *queue_context,
1147 const Thread_queue_Operations *operations
1148);
1149#endif
1150
1159static inline bool _Thread_queue_Is_empty(
1160 const Thread_queue_Queue *queue
1161)
1162{
1163 return queue->heads == NULL;
1164}
1165
1177 Thread_queue_Control *the_thread_queue,
1178 const Thread_queue_Operations *operations
1179);
1180
1202typedef Thread_Control *( *Thread_queue_Flush_filter )(
1203 Thread_Control *the_thread,
1204 Thread_queue_Queue *queue,
1205 Thread_queue_Context *queue_context
1206);
1207
1218 Thread_Control *the_thread,
1219 Thread_queue_Queue *queue,
1220 Thread_queue_Context *queue_context
1221);
1222
1235 Thread_Control *the_thread,
1236 Thread_queue_Queue *queue,
1237 Thread_queue_Context *queue_context
1238);
1239
1252 Thread_Control *the_thread,
1253 Thread_queue_Queue *queue,
1254 Thread_queue_Context *queue_context
1255);
1256
1280 Thread_queue_Queue *queue,
1281 const Thread_queue_Operations *operations,
1283 Thread_queue_Context *queue_context
1284);
1285
1293 Thread_queue_Control *the_thread_queue,
1294 const char *name
1295);
1296
1297#if defined(RTEMS_SMP) && defined(RTEMS_DEBUG) && defined(RTEMS_PROFILING)
1298 #define THREAD_QUEUE_INITIALIZER( _name ) \
1299 { \
1300 .Lock_stats = SMP_LOCK_STATS_INITIALIZER( _name ), \
1301 .owner = SMP_LOCK_NO_OWNER, \
1302 .Queue = { \
1303 .Lock = SMP_TICKET_LOCK_INITIALIZER, \
1304 .heads = NULL, \
1305 .owner = NULL, \
1306 .name = _name \
1307 } \
1308 }
1309#elif defined(RTEMS_SMP) && defined(RTEMS_DEBUG)
1310 #define THREAD_QUEUE_INITIALIZER( _name ) \
1311 { \
1312 .owner = SMP_LOCK_NO_OWNER, \
1313 .Queue = { \
1314 .Lock = SMP_TICKET_LOCK_INITIALIZER, \
1315 .heads = NULL, \
1316 .owner = NULL, \
1317 .name = _name \
1318 } \
1319 }
1320#elif defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
1321 #define THREAD_QUEUE_INITIALIZER( _name ) \
1322 { \
1323 .Lock_stats = SMP_LOCK_STATS_INITIALIZER( _name ), \
1324 .Queue = { \
1325 .Lock = SMP_TICKET_LOCK_INITIALIZER, \
1326 .heads = NULL, \
1327 .owner = NULL, \
1328 .name = _name \
1329 } \
1330 }
1331#elif defined(RTEMS_SMP)
1332 #define THREAD_QUEUE_INITIALIZER( _name ) \
1333 { \
1334 .Queue = { \
1335 .Lock = SMP_TICKET_LOCK_INITIALIZER, \
1336 .heads = NULL, \
1337 .owner = NULL, \
1338 .name = _name \
1339 } \
1340 }
1341#else
1342 #define THREAD_QUEUE_INITIALIZER( _name ) \
1343 { \
1344 .Queue = { \
1345 .heads = NULL, \
1346 .owner = NULL, \
1347 .name = _name \
1348 } \
1349 }
1350#endif
1351
1357static inline void _Thread_queue_Destroy(
1358 Thread_queue_Control *the_thread_queue
1359)
1360{
1361#if defined(RTEMS_SMP)
1362 _SMP_ticket_lock_Destroy( &the_thread_queue->Queue.Lock );
1363 _SMP_lock_Stats_destroy( &the_thread_queue->Lock_stats );
1364#else
1365 (void) the_thread_queue;
1366#endif
1367}
1368
1369#if defined(RTEMS_MULTIPROCESSING)
1376void _Thread_queue_MP_callout_do_nothing(
1377 Thread_Control *the_proxy,
1378 Objects_Id mp_id
1379);
1380
1381bool _Thread_queue_MP_set_callout(
1382 Thread_Control *the_thread,
1383 const Thread_queue_Context *queue_context
1384);
1385
1392void _Thread_queue_Unblock_proxy(
1393 Thread_queue_Queue *queue,
1394 Thread_Control *the_thread
1395);
1396#endif
1397
1401typedef enum {
1406
1412
1413#if defined(RTEMS_SMP)
1434Thread_queue_Deadlock_status _Thread_queue_Path_acquire(
1435 Thread_queue_Queue *queue,
1436 Thread_Control *the_thread,
1437 Thread_queue_Context *queue_context
1438);
1439
1448void _Thread_queue_Path_release(
1449 Thread_queue_Context *queue_context
1450);
1451#endif
1452
1459typedef struct {
1460 Objects_Control Object;
1461 Thread_queue_Control Wait_queue;
1463
1464#define THREAD_QUEUE_OBJECT_ASSERT( object_type, wait_queue_member, msg ) \
1465 RTEMS_STATIC_ASSERT( \
1466 offsetof( object_type, wait_queue_member ) \
1467 == offsetof( Thread_queue_Object, Wait_queue ) \
1468 && RTEMS_HAVE_MEMBER_SAME_TYPE( \
1469 object_type, \
1470 wait_queue_member, \
1471 Thread_queue_Object, \
1472 Wait_queue \
1473 ), \
1474 msg \
1475 )
1476
1477#define THREAD_QUEUE_QUEUE_TO_OBJECT( queue ) \
1478 RTEMS_CONTAINER_OF( \
1479 queue, \
1480 Thread_queue_Object, \
1481 Wait_queue.Queue \
1482 )
1483
1493
1499
1505
1512
1519extern const char _Thread_queue_Object_name[];
1520
1530 Thread_queue_Control *the_thread_queue
1531);
1532
1535#ifdef __cplusplus
1536}
1537#endif
1538
1539#endif
1540/* end of include file */
This header file provides interfaces of the Chain Handler which are only used by the implementation.
This header file provides interfaces of the SMP Support which are used by the implementation and the ...
#define RTEMS_ARRAY_SIZE(_array)
Gets the element count of the array.
Definition: basedefs.h:244
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:385
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
Definition: isrlock.h:364
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:147
uint32_t ISR_Level
Definition: isrlevel.h:60
uint32_t Objects_Id
Definition: object.h:101
#define _Scheduler_Count
This constant contains the count of configured schedulers.
Definition: scheduler.h:395
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
uint32_t States_Control
Definition: states.h:65
Status_Control
Status codes.
Definition: status.h:111
const Thread_queue_Operations _Thread_queue_Operations_priority
The FIFO thread queue operations are used when a thread is enqueued on a thread queue and provide pri...
Definition: threadqops.c:1551
void _Thread_queue_Add_timeout_realtime_timespec(Thread_queue_Queue *queue, Thread_Control *the_thread, Per_CPU_Control *cpu_self, Thread_queue_Context *queue_context)
Adds a monotonic timespec to the thread and sets the watchdog header to realtime.
Definition: threadqtimeout.c:150
#define _Thread_queue_Context_set_MP_callout(queue_context, mp_callout)
Sets the MP callout in the thread queue context.
Definition: threadqimpl.h:535
Thread_queue_Deadlock_status
This is a status code to indicate if a deadlock was detected or not.
Definition: threadqimpl.h:1401
Thread_Control *(* Thread_queue_Flush_filter)(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Thread queue flush filter function.
Definition: threadqimpl.h:1202
void _Thread_queue_Surrender(Thread_queue_Queue *queue, Thread_queue_Heads *heads, Thread_Control *previous_owner, Thread_queue_Context *queue_context, const Thread_queue_Operations *operations)
Surrenders the thread queue previously owned by the thread to the first enqueued thread.
Definition: threadqenqueue.c:698
const Thread_queue_Operations _Thread_queue_Operations_FIFO
The FIFO thread queue operations are used when a thread is enqueued on a thread queue and provide FIF...
Definition: threadqops.c:1543
void _Thread_queue_Enqueue(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Blocks the thread and places it on the thread queue.
Definition: threadqenqueue.c:414
void _Thread_queue_Add_timeout_monotonic_timespec(Thread_queue_Queue *queue, Thread_Control *the_thread, Per_CPU_Control *cpu_self, Thread_queue_Context *queue_context)
Adds a monotonic timespec to the thread and sets the watchdog header to monotonic.
Definition: threadqtimeout.c:130
void _Thread_queue_Resume(Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Resumes the extracted or surrendered thread.
Definition: threadqenqueue.c:670
void _Thread_queue_Deadlock_fatal(Thread_Control *the_thread)
Results in an INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK fatal error.
Definition: threadqenqueue.c:408
void _Thread_queue_Enqueue_do_nothing_extra(Thread_queue_Queue *queue, Thread_Control *the_thread, Per_CPU_Control *cpu_self, Thread_queue_Context *queue_context)
Does nothing.
Definition: threadqenqueue.c:388
const Thread_queue_Operations _Thread_queue_Operations_priority_inherit
The FIFO thread queue operations are used when a thread is enqueued on a thread queue and provide pri...
Definition: threadqops.c:1559
const Thread_queue_Operations _Thread_queue_Operations_default
The default thread queue operations are used when a thread is not enqueued on a thread queue.
Definition: threadqops.c:1534
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
bool _Thread_queue_Extract_locked(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Extracts the thread from the thread queue, restores the default wait operations and restores the defa...
Definition: threadqenqueue.c:656
Status_Control _Thread_queue_Surrender_priority_ceiling(Thread_queue_Queue *queue, Thread_Control *executing, Priority_Node *ceiling_priority, Thread_queue_Context *queue_context, const Thread_queue_Operations *operations)
Surrenders the thread queue previously owned by the thread to the first enqueued thread.
Definition: threadqenqueue.c:767
void(* Thread_queue_Deadlock_callout)(Thread_Control *the_thread)
Thread queue deadlock callout.
Definition: threadq.h:105
const char _Thread_queue_Object_name[]
The special thread queue name to indicated that the thread queue is embedded in an object with identi...
Definition: threadq.c:157
void _Thread_queue_Surrender_no_priority(Thread_queue_Queue *queue, Thread_queue_Heads *heads, Thread_queue_Context *queue_context, const Thread_queue_Operations *operations)
Surrenders the thread queue previously owned by the thread to the first enqueued thread.
Definition: threadqenqueue.c:746
Thread_Control * _Thread_queue_Flush_status_object_was_deleted(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Status object was deleted thread queue flush filter function.
Definition: threadqflush.c:60
void _Thread_queue_Add_timeout_by_clock_id_timespec(Thread_queue_Queue *queue, Thread_Control *the_thread, Per_CPU_Control *cpu_self, Thread_queue_Context *queue_context)
Adds a timeout to the thread queue context and sets the enqueue callout to add a timeout based on the...
Definition: threadqtimeout.c:170
size_t _Thread_queue_Queue_get_name_and_id(const Thread_queue_Queue *queue, char *buffer, size_t buffer_size, Objects_Id *id)
Copies the thread queue name to the specified buffer.
Definition: threadqgetnameandid.c:46
size_t _Thread_queue_Flush_critical(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_queue_Flush_filter filter, Thread_queue_Context *queue_context)
Unblocks all threads enqueued on the thread queue.
Definition: threadqflush.c:86
void _Thread_queue_Deadlock_status(Thread_Control *the_thread)
Sets the thread wait return code to STATUS_DEADLOCK.
Definition: threadqenqueue.c:403
Thread_Control * _Thread_queue_First(Thread_queue_Control *the_thread_queue, const Thread_queue_Operations *operations)
Returns the first thread on the thread queue if it exists, otherwise NULL.
Definition: threadqfirst.c:44
void _Thread_queue_Extract(Thread_Control *the_thread)
Extracts thread from thread queue.
Definition: threadqextract.c:47
Thread_Control * _Thread_queue_Flush_default_filter(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Default thread queue flush filter function.
Definition: threadqflush.c:49
void _Thread_queue_Object_initialize(Thread_queue_Control *the_thread_queue)
Initializes a thread queue embedded in an object with identifier.
Definition: threadq.c:170
void _Thread_queue_Add_timeout_ticks(Thread_queue_Queue *queue, Thread_Control *the_thread, Per_CPU_Control *cpu_self, Thread_queue_Context *queue_context)
Adds timeout ticks of the queue to the thread.
Definition: threadqtimeout.c:48
void _Thread_queue_Initialize(Thread_queue_Control *the_thread_queue, const char *name)
Initializes the thread queue control to the given name.
Definition: threadq.c:159
Thread_Control * _Thread_queue_Flush_status_unavailable(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Status unavailable thread queue flush filter function.
Definition: threadqflush.c:73
@ THREAD_QUEUE_DEADLOCK_DETECTED
The operation detected a deadlock.
Definition: threadqimpl.h:1410
@ THREAD_QUEUE_NO_DEADLOCK
The operation did not detect a deadlock.
Definition: threadqimpl.h:1405
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdogticks.h:59
This header file provides interfaces of the Priority Handler which are only used by the implementatio...
This header file provides interfaces of the Scheduler Handler which are used by the implementation an...
This header file provides the interfaces of the Operation Status Support.
This header file provides interfaces of the Thread Handler which are used by the implementation and t...
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:94
Definition: objectdata.h:61
Per CPU Core Structure.
Definition: percpu.h:384
The priority node to build up a priority aggregation.
Definition: priority.h:112
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
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
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:149
Helper structure to ensure that all objects containing a thread queue have the right layout.
Definition: threadqimpl.h:1459
The thread queue operations are used to manage the threads of a thread queue.
Definition: threadq.h:563
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
Thread queue with a layout compatible to struct _Thread_queue_Queue defined in Newlib <sys/lock....
Definition: threadqimpl.h:71
Definition: thread.h:837
Thread queue heads.
Definition: threadq.h:394
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
This header file provides the interfaces of the Thread Handler related to thread dispatching.
This header file provides interfaces of the Thread Queue Handler which are used by the implementation...
This union represents a chain control block.
Definition: chain.h:96