RTEMS
Files | Classes | Macros | Typedefs | Functions | Variables
Thread Queue Handler

Thread Queue Handler. More...

Files

file  threadq.h
 Constants and Structures Needed to Declare a Thread Queue.
 
file  threadqimpl.h
 Constants and Structures Associated with the Manipulation of Objects.
 

Classes

struct  Thread_queue_Gate
 The thread queue gate is an SMP synchronization means. More...
 
struct  Thread_queue_Lock_context
 
struct  Thread_queue_Link
 A thread queue link from one thread to another specified by the thread queue owner and thread wait queue relationships. More...
 
struct  Thread_queue_Context
 Thread queue context for the thread queue methods. More...
 
struct  Thread_queue_Priority_queue
 Thread priority queue. More...
 
struct  _Thread_queue_Heads
 Thread queue heads. More...
 
struct  Thread_queue_Queue
 
struct  Thread_queue_Operations
 Thread queue operations. More...
 
struct  Thread_queue_Control
 
struct  Thread_queue_Syslock_queue
 Thread queue with a layout compatible to struct _Thread_queue_Queue defined in Newlib <sys/lock.h>. More...
 
struct  Thread_queue_Object
 Helper structure to ensure that all objects containing a thread queue have the right layout. More...
 

Macros

#define THREAD_QUEUE_LINK_OF_PATH_NODE(node)   RTEMS_CONTAINER_OF( node, Thread_queue_Link, Path_node );
 
#define _Thread_queue_Context_ISR_disable(queue_context, level)
 
#define _Thread_queue_Context_set_MP_callout(queue_context, mp_callout)
 Sets the MP callout in the thread queue context. More...
 
#define _Thread_queue_Queue_acquire_critical(queue, lock_stats, lock_context)   _Thread_queue_Queue_do_acquire_critical( queue, lock_context )
 
#define _Thread_queue_Dequeue(the_thread_queue, operations, mp_callout)
 Gets a pointer to a thread waiting on the_thread_queue. More...
 
#define THREAD_QUEUE_INITIALIZER(_name)
 
#define THREAD_QUEUE_OBJECT_ASSERT(object_type, wait_queue_member, msg)
 
#define THREAD_QUEUE_QUEUE_TO_OBJECT(queue)
 

Typedefs

typedef struct _Thread_Control Thread_Control
 
typedef struct Thread_queue_Context Thread_queue_Context
 
typedef struct Thread_queue_Queue Thread_queue_Queue
 
typedef struct Thread_queue_Operations Thread_queue_Operations
 
typedef 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. More...
 
typedef void(* Thread_queue_Deadlock_callout) (Thread_Control *the_thread)
 Thread queue deadlock callout. More...
 
typedef struct _Thread_queue_Heads Thread_queue_Heads
 Thread queue heads. More...
 
typedef void(* Thread_queue_Priority_actions_operation) (Thread_queue_Queue *queue, Priority_Actions *priority_actions)
 Thread queue action operation. More...
 
typedef void(* Thread_queue_Enqueue_operation) (Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Thread queue enqueue operation. More...
 
typedef void(* Thread_queue_Extract_operation) (Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Thread queue extract operation. More...
 
typedef 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. More...
 
typedef Thread_Control *(* Thread_queue_First_operation) (Thread_queue_Heads *heads)
 Thread queue first operation. More...
 
typedef Thread_Control *(* Thread_queue_Flush_filter) (Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
 Thread queue flush filter function. More...
 

Functions

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. More...
 
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. More...
 
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. More...
 
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. More...
 
void _Thread_queue_Deadlock_status (Thread_Control *the_thread)
 Sets the thread wait return code to STATUS_DEADLOCK. More...
 
void _Thread_queue_Deadlock_fatal (Thread_Control *the_thread)
 Results in an INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK fatal error. More...
 
static __inline__ void _Thread_queue_Context_initialize (Thread_queue_Context *queue_context)
 Initializes a thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_thread_state (Thread_queue_Context *queue_context, States_Control thread_state)
 Sets the thread state for the thread to enqueue in the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_timeout_ticks (Thread_queue_Context *queue_context, Watchdog_Interval ticks)
 Sets the timeout ticks in the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_timeout_argument (Thread_queue_Context *queue_context, const void *arg)
 Sets the timeout argument in the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_enqueue_callout (Thread_queue_Context *queue_context, Thread_queue_Enqueue_callout enqueue_callout)
 Sets the enqueue callout in the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_enqueue_do_nothing_extra (Thread_queue_Context *queue_context)
 Sets the do nothing enqueue callout in the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_enqueue_timeout_ticks (Thread_queue_Context *queue_context, Watchdog_Interval ticks)
 Sets the enqueue callout to add a relative monotonic timeout in ticks. More...
 
static __inline__ void _Thread_queue_Context_set_enqueue_timeout_monotonic_timespec (Thread_queue_Context *queue_context, const struct timespec *abstime)
 Sets the enqueue callout to add an absolute monotonic timeout in timespec format. More...
 
static __inline__ void _Thread_queue_Context_set_enqueue_timeout_realtime_timespec (Thread_queue_Context *queue_context, const struct timespec *abstime)
 Sets the enqueue callout to add an absolute realtime timeout in timespec format. More...
 
static __inline__ void _Thread_queue_Context_set_deadlock_callout (Thread_queue_Context *queue_context, Thread_queue_Deadlock_callout deadlock_callout)
 Sets the deadlock callout in the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_clear_priority_updates (Thread_queue_Context *queue_context)
 Clears the priority update count of the thread queue context. More...
 
static __inline__ size_t _Thread_queue_Context_save_priority_updates (Thread_queue_Context *queue_context)
 Returns the priority update count of the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_restore_priority_updates (Thread_queue_Context *queue_context, size_t update_count)
 Sets the priority update count of the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_add_priority_update (Thread_queue_Context *queue_context, Thread_Control *the_thread)
 Adds a priority update of the thread to the thread queue context. More...
 
static __inline__ void _Thread_queue_Context_set_ISR_level (Thread_queue_Context *queue_context, ISR_Level level)
 Sets the thread queue context ISR level. More...
 
static __inline__ Per_CPU_Control_Thread_queue_Dispatch_disable (Thread_queue_Context *queue_context)
 Disables dispatching in a critical section. More...
 
static __inline__ void _Thread_queue_Gate_close (Thread_queue_Gate *gate)
 Closes the gate. More...
 
static __inline__ void _Thread_queue_Gate_add (Chain_Control *chain, Thread_queue_Gate *gate)
 Adds the gate to the chain. More...
 
static __inline__ void _Thread_queue_Gate_open (Thread_queue_Gate *gate)
 Opens the gate. More...
 
static __inline__ void _Thread_queue_Gate_wait (Thread_queue_Gate *gate)
 Waits on a gate to open. More...
 
static __inline__ void _Thread_queue_Heads_initialize (Thread_queue_Heads *heads)
 Initializes the thread queue heads. More...
 
static __inline__ void _Thread_queue_Queue_initialize (Thread_queue_Queue *queue, const char *name)
 Initializes the thread queue queue with the given name. More...
 
static __inline__ void _Thread_queue_Queue_do_acquire_critical (Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
 Acquires the thread queue queue in a critical section. More...
 
static __inline__ void _Thread_queue_Queue_release_critical (Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
 Releases the thread queue queue in a critical section. More...
 
static __inline__ void _Thread_queue_Queue_release (Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
 Releases the thread queue queue and enables interrupts. More...
 
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. More...
 
void _Thread_queue_Do_acquire_critical (Thread_queue_Control *the_thread_queue, ISR_lock_Context *lock_context)
 Acquires the thread queue control in a critical section. More...
 
static __inline__ void _Thread_queue_Acquire_critical (Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
 Acquires the thread queue control in a critical section. More...
 
void _Thread_queue_Acquire (Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
 Acquires the thread queue control in a critical section. More...
 
void _Thread_queue_Do_release_critical (Thread_queue_Control *the_thread_queue, ISR_lock_Context *lock_context)
 Checks if the thread queue control is the owner of the lock. More...
 
static __inline__ void _Thread_queue_Release_critical (Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
 Releases the thread queue control in a critical section. More...
 
void _Thread_queue_Release (Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
 Releases the thread queue control and enables interrupts. More...
 
Thread_Control_Thread_queue_Do_dequeue (Thread_queue_Control *the_thread_queue, const Thread_queue_Operations *operations)
 Dequeues the first thread waiting on the thread queue and returns it. More...
 
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. More...
 
Status_Control _Thread_queue_Enqueue_sticky (Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Enqueues the thread on the thread queue and busy waits for dequeue. More...
 
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 default thread lock. More...
 
void _Thread_queue_Unblock_critical (bool unblock, Thread_queue_Queue *queue, Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Unblocks the thread which was on the thread queue before. More...
 
void _Thread_queue_Extract_critical (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 and unblocks it. More...
 
void _Thread_queue_Extract (Thread_Control *the_thread)
 Extracts thread from thread queue. More...
 
void _Thread_queue_Extract_with_proxy (Thread_Control *the_thread)
 Extracts the_thread from the_thread_queue. More...
 
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. More...
 
void _Thread_queue_Surrender_sticky (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. More...
 
static __inline__ bool _Thread_queue_Is_empty (const Thread_queue_Queue *queue)
 Checks if the thread queue queue is empty. More...
 
static __inline__ Thread_Control_Thread_queue_First_locked (Thread_queue_Control *the_thread_queue, const Thread_queue_Operations *operations)
 Returns the first thread on the thread queue if it exists, otherwise NULL. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void _Thread_queue_Initialize (Thread_queue_Control *the_thread_queue, const char *name)
 Initializes the thread queue control to the given name. More...
 
static __inline__ void _Thread_queue_Destroy (Thread_queue_Control *the_thread_queue)
 Destroys the thread queue. More...
 
bool _Thread_queue_Path_acquire_critical (Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Does nothing. More...
 
void _Thread_queue_Path_release_critical (Thread_queue_Context *queue_context)
 Releases the thread queue path in a critical section. More...
 
void _Thread_queue_Object_initialize (Thread_queue_Control *the_thread_queue)
 Initializes a thread queue embedded in an object with identifier. More...
 

Variables

const Thread_queue_Operations _Thread_queue_Operations_default
 
const Thread_queue_Operations _Thread_queue_Operations_FIFO
 
const Thread_queue_Operations _Thread_queue_Operations_priority
 
const Thread_queue_Operations _Thread_queue_Operations_priority_inherit
 
const char _Thread_queue_Object_name []
 The special thread queue name to indicated that the thread queue is embedded in an object with identifier. More...
 

Detailed Description

Thread Queue Handler.

This handler provides the capability to have threads block in ordered sets. The sets may be ordered using the FIFO or priority discipline.

Macro Definition Documentation

◆ _Thread_queue_Context_ISR_disable

#define _Thread_queue_Context_ISR_disable (   queue_context,
  level 
)
Value:
do { \
_ISR_Local_disable( level ); \
_ISR_lock_ISR_disable_profile( \
&( queue_context )->Lock_context.Lock_context \
) \
} while ( 0 )

Definition at line 397 of file threadqimpl.h.

◆ _Thread_queue_Context_set_MP_callout

#define _Thread_queue_Context_set_MP_callout (   queue_context,
  mp_callout 
)
Value:
do { \
(void) queue_context; \
} while ( 0 )

Sets the MP callout in the thread queue context.

Parameters
[out]queue_contextThe thread queue context.
mp_calloutCallout to unblock the thread in case it is actually a thread proxy. This parameter is only used on multiprocessing configurations. Used by thread queue extract and unblock methods for objects with multiprocessing (MP) support.

Definition at line 456 of file threadqimpl.h.

◆ _Thread_queue_Dequeue

#define _Thread_queue_Dequeue (   the_thread_queue,
  operations,
  mp_callout 
)
Value:
the_thread_queue, \
operations \
)
Thread_Control * _Thread_queue_Do_dequeue(Thread_queue_Control *the_thread_queue, const Thread_queue_Operations *operations)
Dequeues the first thread waiting on the thread queue and returns it.

Gets a pointer to a thread waiting on the_thread_queue.

This function returns a pointer to a thread waiting on the_thread_queue. The selection of this thread is based on the discipline of the_thread_queue. If no threads are waiting on the_thread_queue, then NULL is returned.

  • INTERRUPT LATENCY:
    • single case

Definition at line 838 of file threadqimpl.h.

◆ THREAD_QUEUE_INITIALIZER

#define THREAD_QUEUE_INITIALIZER (   _name)
Value:
{ \
.Queue = { \
.heads = NULL, \
.owner = NULL, \
.name = _name \
} \
}
#define SMP_TICKET_LOCK_INITIALIZER
SMP ticket lock control initializer for static initialization.
Definition: smplockticket.h:48

Definition at line 1353 of file threadqimpl.h.

◆ THREAD_QUEUE_OBJECT_ASSERT

#define THREAD_QUEUE_OBJECT_ASSERT (   object_type,
  wait_queue_member,
  msg 
)
Value:
offsetof( object_type, wait_queue_member ) \
== offsetof( Thread_queue_Object, Wait_queue ) \
object_type, \
wait_queue_member, \
Wait_queue \
), \
msg \
)
#define RTEMS_STATIC_ASSERT(_cond, _msg)
Asserts at compile time that the specified condition is satisfied.
Definition: basedefs.h:838
Helper structure to ensure that all objects containing a thread queue have the right layout...
Definition: threadqimpl.h:1445
#define RTEMS_HAVE_MEMBER_SAME_TYPE(_t_lhs, _m_lhs, _t_rhs, _m_rhs)
Evaluates to true if the specified members of two types have compatible types, otherwise to false...
Definition: basedefs.h:665

Definition at line 1450 of file threadqimpl.h.

◆ THREAD_QUEUE_QUEUE_TO_OBJECT

#define THREAD_QUEUE_QUEUE_TO_OBJECT (   queue)
Value:
queue, \
Wait_queue.Queue \
)
#define RTEMS_CONTAINER_OF(_m, _type, _member_name)
Returns the pointer to the container of a specified member pointer.
Definition: basedefs.h:550
Helper structure to ensure that all objects containing a thread queue have the right layout...
Definition: threadqimpl.h:1445

Definition at line 1463 of file threadqimpl.h.

Typedef Documentation

◆ Thread_queue_Deadlock_callout

typedef void( * Thread_queue_Deadlock_callout) (Thread_Control *the_thread)

Thread queue deadlock callout.

Parameters
the_threadThe thread that detected the deadlock.
See also
_Thread_queue_Context_set_deadlock_callout().

Definition at line 86 of file threadq.h.

◆ Thread_queue_Enqueue_callout

typedef 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.

Parameters
[in]queueThe actual thread queue.
[in]the_threadThe thread to enqueue.
[in]cpu_selfThe current processor.
[in]queue_contextThe thread queue context of the lock acquire.
See also
_Thread_queue_Context_set_enqueue_callout().

Definition at line 72 of file threadq.h.

◆ Thread_queue_Enqueue_operation

typedef void( * Thread_queue_Enqueue_operation) (Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)

Thread queue enqueue operation.

A potential thread to update the priority due to priority inheritance is returned via the thread queue context. This thread is handed over to _Thread_Priority_update().

Parameters
[in]queueThe actual thread queue.
[in]the_threadThe thread to enqueue on the queue.

Definition at line 463 of file threadq.h.

◆ Thread_queue_Extract_operation

typedef void( * Thread_queue_Extract_operation) (Thread_queue_Queue *queue, Thread_Control *the_thread, Thread_queue_Context *queue_context)

Thread queue extract operation.

Parameters
[in]queueThe actual thread queue.
[in]the_threadThe thread to extract from the thread queue.

Definition at line 475 of file threadq.h.

◆ Thread_queue_First_operation

typedef Thread_Control*( * Thread_queue_First_operation) (Thread_queue_Heads *heads)

Thread queue first operation.

Parameters
[in]headsThe thread queue heads.
Return values
NULLNo thread is present on the thread queue.
firstThe first thread of the thread queue according to the insert order. This thread remains on the thread queue.

Definition at line 508 of file threadq.h.

◆ Thread_queue_Flush_filter

typedef Thread_Control*( * Thread_queue_Flush_filter) (Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)

Thread queue flush filter function.

Called under protection of the thread queue lock by _Thread_queue_Flush_critical() to optionally alter the thread wait information and control the iteration.

Parameters
the_threadThe thread to extract. This is the first parameter to optimize for architectures that use the same register for the first parameter and the return value.
queueThe actual thread queue.
queue_contextThe thread queue context of the lock acquire. May be used to pass additional data to the filter function via an overlay structure. The filter function should not release or acquire the thread queue lock.
Return values
the_threadExtract this thread.
NULLDo not extract this thread and stop the thread queue flush operation. Threads that are already extracted will complete the flush operation.

Definition at line 1223 of file threadqimpl.h.

◆ Thread_queue_Heads

Thread queue heads.

Each thread is equipped with spare thread queue heads in case it is not enqueued on a thread queue. The first thread enqueued on a thread queue will give its spare thread queue heads to that thread queue. The threads arriving at the queue will add their thread queue heads to the free chain of the queue heads provided by the first thread enqueued. Once a thread is dequeued it use the free chain to get new spare thread queue heads.

Uses a leading underscore in the structure name to allow forward declarations in standard header files provided by Newlib and GCC.

◆ Thread_queue_Priority_actions_operation

typedef void( * Thread_queue_Priority_actions_operation) (Thread_queue_Queue *queue, Priority_Actions *priority_actions)

Thread queue action operation.

Parameters
[in]queueThe actual thread queue.
[in]the_threadThe thread.
[in]queue_contextThe thread queue context providing the thread queue action set to perform. Returns the thread queue action set to perform on the thread queue owner or the empty set in case there is nothing to do.

Definition at line 448 of file threadq.h.

◆ Thread_queue_Surrender_operation

typedef 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.

This operation must dequeue and return the first thread on the queue.

Parameters
[in]queueThe actual thread queue.
[in]headsThe thread queue heads. It must not be NULL.
[in]previous_ownerThe previous owner of the thread queue.
Returns
The previous first thread on the queue.

Definition at line 492 of file threadq.h.

Function Documentation

◆ _Thread_queue_Acquire()

void _Thread_queue_Acquire ( Thread_queue_Control the_thread_queue,
Thread_queue_Context queue_context 
)

Acquires the thread queue control in a critical section.

Parameters
the_thread_queueThe thread queue control to acquire.
[out]queue_contextThe thread queue context.

Definition at line 87 of file threadq.c.

◆ _Thread_queue_Acquire_critical()

static __inline__ void _Thread_queue_Acquire_critical ( Thread_queue_Control the_thread_queue,
Thread_queue_Context queue_context 
)
static

Acquires the thread queue control in a critical section.

Parameters
the_thread_queueThe thread queue control to acquire.
[out]lock_contextThe interrupt lock context.

Definition at line 681 of file threadqimpl.h.

◆ _Thread_queue_Add_timeout_monotonic_timespec()

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.

Parameters
queueThis parameter is unused.
[in,out]the_threadThe thread to add the timeout and set watchdog header to monotonic.
cpu_selfThe cpu to get the monotonic watchdog header from.
queue_contextThe thread queue context.

Definition at line 90 of file threadqtimeout.c.

◆ _Thread_queue_Add_timeout_realtime_timespec()

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.

Parameters
queueThis parameter is unused.
[in,out]the_threadThe thread to add the timeout and set watchdog header to realtime.
cpu_selfThe cpu to get the realtime watchdog header from.
queue_contextThe thread queue context.

Definition at line 110 of file threadqtimeout.c.

◆ _Thread_queue_Add_timeout_ticks()

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.

Parameters
queueThis parameter is unused.
[in,out]the_threadThe thread to add timeout ticks to.
cpu_selfThe cpu for the operation.
queue_contextThe thread queue context.

Definition at line 17 of file threadqtimeout.c.

◆ _Thread_queue_Context_add_priority_update()

static __inline__ void _Thread_queue_Context_add_priority_update ( Thread_queue_Context queue_context,
Thread_Control the_thread 
)
static

Adds a priority update of the thread to the thread queue context.

Parameters
[in,out]queue_contextThe thread queue context to increase the priority update count of and set the_thread in its Priority update array.
the_threadThe thread for the priority update.

Definition at line 383 of file threadqimpl.h.

◆ _Thread_queue_Context_clear_priority_updates()

static __inline__ void _Thread_queue_Context_clear_priority_updates ( Thread_queue_Context queue_context)
static

Clears the priority update count of the thread queue context.

Parameters
[out]queue_contextThe thread queue context to clear the priority update count.

Definition at line 338 of file threadqimpl.h.

◆ _Thread_queue_Context_initialize()

static __inline__ void _Thread_queue_Context_initialize ( Thread_queue_Context queue_context)
static

Initializes a thread queue context.

Parameters
[out]queue_contextThe thread queue context to initialize.

Definition at line 152 of file threadqimpl.h.

◆ _Thread_queue_Context_restore_priority_updates()

static __inline__ void _Thread_queue_Context_restore_priority_updates ( Thread_queue_Context queue_context,
size_t  update_count 
)
static

Sets the priority update count of the thread queue context.

Parameters
[out]queue_contextThe thread queue context to set the priority update count of.
update_countThe priority update count.

Definition at line 367 of file threadqimpl.h.

◆ _Thread_queue_Context_save_priority_updates()

static __inline__ size_t _Thread_queue_Context_save_priority_updates ( Thread_queue_Context queue_context)
static

Returns the priority update count of the thread queue context.

Parameters
queue_contextThe thread queue context to get the priority update count of.
Returns
The priority update count of queue_context.

Definition at line 353 of file threadqimpl.h.

◆ _Thread_queue_Context_set_deadlock_callout()

static __inline__ void _Thread_queue_Context_set_deadlock_callout ( Thread_queue_Context queue_context,
Thread_queue_Deadlock_callout  deadlock_callout 
)
static

Sets the deadlock callout in the thread queue context.

A deadlock callout must be provided for _Thread_queue_Enqueue() operations that operate on thread queues which may have an owner, e.g. mutex objects. Available deadlock callouts are _Thread_queue_Deadlock_status() and _Thread_queue_Deadlock_fatal().

Parameters
[out]queue_contextThe thread queue context.
deadlock_calloutThe deadlock callout.
See also
_Thread_queue_Enqueue().

Definition at line 324 of file threadqimpl.h.

◆ _Thread_queue_Context_set_enqueue_callout()

static __inline__ void _Thread_queue_Context_set_enqueue_callout ( Thread_queue_Context queue_context,
Thread_queue_Enqueue_callout  enqueue_callout 
)
static

Sets the enqueue callout in the thread queue context.

Parameters
[out]queue_contextThe thread queue context.
enqueue_calloutThe enqueue callout.
See also
_Thread_queue_Enqueue().

Definition at line 229 of file threadqimpl.h.

◆ _Thread_queue_Context_set_enqueue_do_nothing_extra()

static __inline__ void _Thread_queue_Context_set_enqueue_do_nothing_extra ( Thread_queue_Context queue_context)
static

Sets the do nothing enqueue callout in the thread queue context.

Parameters
[out]queue_contextThe thread queue context.
See also
_Thread_queue_Enqueue().

Definition at line 245 of file threadqimpl.h.

◆ _Thread_queue_Context_set_enqueue_timeout_monotonic_timespec()

static __inline__ void _Thread_queue_Context_set_enqueue_timeout_monotonic_timespec ( Thread_queue_Context queue_context,
const struct timespec *  abstime 
)
static

Sets the enqueue callout to add an absolute monotonic timeout in timespec format.

Parameters
[out]queue_contextThe thread queue context.
abstimeThe absolute monotonic timeout.
See also
_Thread_queue_Enqueue().

Definition at line 281 of file threadqimpl.h.

◆ _Thread_queue_Context_set_enqueue_timeout_realtime_timespec()

static __inline__ void _Thread_queue_Context_set_enqueue_timeout_realtime_timespec ( Thread_queue_Context queue_context,
const struct timespec *  abstime 
)
static

Sets the enqueue callout to add an absolute realtime timeout in timespec format.

Parameters
[out]queue_contextThe thread queue context.
abstimeThe absolute realtime timeout.
See also
_Thread_queue_Enqueue().

Definition at line 301 of file threadqimpl.h.

◆ _Thread_queue_Context_set_enqueue_timeout_ticks()

static __inline__ void _Thread_queue_Context_set_enqueue_timeout_ticks ( Thread_queue_Context queue_context,
Watchdog_Interval  ticks 
)
static

Sets the enqueue callout to add a relative monotonic timeout in ticks.

Parameters
[out]queue_contextThe thread queue context.
ticksThe timeout in ticks.
See also
_Thread_queue_Enqueue().

Definition at line 262 of file threadqimpl.h.

◆ _Thread_queue_Context_set_ISR_level()

static __inline__ void _Thread_queue_Context_set_ISR_level ( Thread_queue_Context queue_context,
ISR_Level  level 
)
static

Sets the thread queue context ISR level.

Parameters
[out]queue_contextThe thread queue context to set the ISR level of.
levelThe ISR level to set queue_context to.

Definition at line 411 of file threadqimpl.h.

◆ _Thread_queue_Context_set_thread_state()

static __inline__ void _Thread_queue_Context_set_thread_state ( Thread_queue_Context queue_context,
States_Control  thread_state 
)
static

Sets the thread state for the thread to enqueue in the thread queue context.

Parameters
[out]queue_contextThe thread queue context.
stateThe thread state.
See also
_Thread_queue_Enqueue().

Definition at line 178 of file threadqimpl.h.

◆ _Thread_queue_Context_set_timeout_argument()

static __inline__ void _Thread_queue_Context_set_timeout_argument ( Thread_queue_Context queue_context,
const void *  arg 
)
static

Sets the timeout argument in the thread queue context.

Parameters
[out]queue_contextThe thread queue context.
argThe timeout argument.
See also
_Thread_queue_Enqueue().

Definition at line 212 of file threadqimpl.h.

◆ _Thread_queue_Context_set_timeout_ticks()

static __inline__ void _Thread_queue_Context_set_timeout_ticks ( Thread_queue_Context queue_context,
Watchdog_Interval  ticks 
)
static

Sets the timeout ticks in the thread queue context.

Parameters
[out]queue_contextThe thread queue context.
ticksThe timeout in ticks.
See also
_Thread_queue_Enqueue().

Definition at line 195 of file threadqimpl.h.

◆ _Thread_queue_Deadlock_fatal()

void _Thread_queue_Deadlock_fatal ( Thread_Control the_thread)

Results in an INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK fatal error.

Parameters
the_threadThe thread for the operation.

Definition at line 375 of file threadqenqueue.c.

◆ _Thread_queue_Deadlock_status()

void _Thread_queue_Deadlock_status ( Thread_Control the_thread)

Sets the thread wait return code to STATUS_DEADLOCK.

Parameters
[out]the_threadThe thread to set the wait return code to STATUS_DEADLOCK.

Definition at line 370 of file threadqenqueue.c.

◆ _Thread_queue_Destroy()

static __inline__ void _Thread_queue_Destroy ( Thread_queue_Control the_thread_queue)
static

Destroys the thread queue.

Parameters
[out]the_thread_queueThe thread queue to destroy.

Definition at line 1378 of file threadqimpl.h.

◆ _Thread_queue_Dispatch_disable()

static __inline__ Per_CPU_Control* _Thread_queue_Dispatch_disable ( Thread_queue_Context queue_context)
static

Disables dispatching in a critical section.

Parameters
queue_contextThe thread queue context to get the lock context from.
Returns
The current processor.

Definition at line 429 of file threadqimpl.h.

◆ _Thread_queue_Do_acquire_critical()

void _Thread_queue_Do_acquire_critical ( Thread_queue_Control the_thread_queue,
ISR_lock_Context lock_context 
)

Acquires the thread queue control in a critical section.

Parameters
the_thread_queueThe thread queue control to acquire.
[out]lock_contextThe interrupt lock context.

Definition at line 72 of file threadq.c.

◆ _Thread_queue_Do_dequeue()

Thread_Control* _Thread_queue_Do_dequeue ( Thread_queue_Control the_thread_queue,
const Thread_queue_Operations operations 
)

Dequeues the first thread waiting on the thread queue and returns it.

Parameters
the_thread_queueThe thread queue for the operation.
operationsThe thread queue operations.
Returns
The first locked thread.

Definition at line 742 of file threadqenqueue.c.

◆ _Thread_queue_Do_release_critical()

void _Thread_queue_Do_release_critical ( Thread_queue_Control the_thread_queue,
ISR_lock_Context lock_context 
)

Checks if the thread queue control is the owner of the lock.

Parameters
the_thread_queueThe thread queue control for the verification.
Return values
trueThe thread queue control is the owner of the lock.
falseThe thread queue control is not the owner of the lock. Releases the thread queue control in a critical section.
Parameters
the_thread_queueThe thread queue control to release.
[out]lock_contextThe interrupt lock context.

Definition at line 103 of file threadq.c.

◆ _Thread_queue_Enqueue()

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.

This enqueues the thread on the thread queue, blocks the thread, and optionally starts the thread timer in case the timeout discipline is not WATCHDOG_NO_TIMEOUT. Timeout discipline and value are in the queue_context.

The caller must be the owner of the thread queue lock. This function will release the thread queue lock and register it as the new thread lock. Thread dispatching is disabled before the thread queue lock is released. Thread dispatching is enabled once the sequence to block the thread is complete. The operation to enqueue the thread on the queue is protected by the thread queue lock. This makes it possible to use the thread queue lock to protect the state of objects embedding the thread queue and directly enter _Thread_queue_Enqueue() in case the thread must block.

The thread queue context must be set up with the following functions, otherwise the behaviour is unpredictable

#define MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority
typedef struct {
} Mutex;
void _Mutex_Obtain( Mutex *mutex )
{
Thread_queue_Context queue_context;
Thread_Control *executing;
_Thread_queue_Acquire( &mutex->Queue, queue_context );
executing = _Thread_Executing;
if ( mutex->Queue.owner == NULL ) {
mutex->Queue.owner = executing;
_Thread_queue_Release( &mutex->Queue, queue_context );
} else {
&queue_context,
);
queue_context,
);
&mutex->Queue.Queue,
MUTEX_TQ_OPERATIONS,
executing,
&queue_context
);
}
}
Parameters
queueThe actual thread queue.
operationsThe thread queue operations.
[in,out]the_threadThe thread to enqueue.
[in,out]queue_contextThe thread queue context of the lock acquire.

Definition at line 380 of file threadqenqueue.c.

◆ _Thread_queue_Enqueue_do_nothing_extra()

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.

Parameters
queueThis parameter is unused.
the_threadThis parameter is unused.
cpu_selfThis parameter is unused.
queue_contextThis parameter is unused.

Definition at line 360 of file threadqenqueue.c.

◆ _Thread_queue_Enqueue_sticky()

Status_Control _Thread_queue_Enqueue_sticky ( Thread_queue_Queue queue,
const Thread_queue_Operations operations,
Thread_Control the_thread,
Thread_queue_Context queue_context 
)

Enqueues the thread on the thread queue and busy waits for dequeue.

Optionally starts the thread timer in case the timeout discipline is not WATCHDOG_NO_TIMEOUT. Timeout discipline and value are in the queue_context.

The caller must be the owner of the thread queue lock. This function will release the thread queue lock and register it as the new thread lock.

The thread priorities of the owner and the are updated with respect to the scheduler. The sticky level of the thread is incremented. A thread dispatch is performed if necessary.

Afterwards, the thread busy waits on the thread wait flags until a timeout occurs or the thread queue is surrendered to this thread. So, it sticks to the processor instead of blocking with respect to the scheduler.

Parameters
queueThe actual thread queue.
operationsThe thread queue operations.
[in,out]the_threadThe thread to enqueue.
[in,out]queue_contextThe thread queue context of the lock acquire.

Definition at line 456 of file threadqenqueue.c.

◆ _Thread_queue_Extract()

void _Thread_queue_Extract ( Thread_Control the_thread)

Extracts thread from thread queue.

This routine removes the_thread its thread queue and cancels any timeouts associated with this blocking.

Parameters
[in,out]the_threadThe pointer to a thread control block that is to be removed

Definition at line 624 of file threadqenqueue.c.

◆ _Thread_queue_Extract_critical()

void _Thread_queue_Extract_critical ( 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 and unblocks it.

The caller must be the owner of the thread queue lock. This function will release the thread queue lock and restore the default thread lock. Thread dispatching is disabled before the thread queue lock is released and an unblock is necessary. Thread dispatching is enabled once the sequence to unblock the thread is complete. This makes it possible to use the thread queue lock to protect the state of objects embedding the thread queue and directly enter _Thread_queue_Extract_critical() to finalize an operation in case a waiting thread exists.

typedef struct {
} Mutex;
void _Mutex_Release( Mutex *mutex )
{
Thread_queue_Context queue_context;
_Thread_queue_Context_initialize( &queue_context, NULL );
_Thread_queue_Acquire( &mutex->Queue, queue_context );
first = _Thread_queue_First_locked( &mutex->Queue );
mutex->owner = first;
if ( first != NULL ) {
&mutex->Queue.Queue,
mutex->Queue.operations,
first,
&queue_context
);
}
Parameters
queueThe actual thread queue.
operationsThe thread queue operations.
[in,out]the_threadThe thread to extract.
[in,out]queue_contextThe thread queue context of the lock acquire.

Definition at line 600 of file threadqenqueue.c.

◆ _Thread_queue_Extract_locked()

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 default thread lock.

The caller must be the owner of the thread queue lock. The thread queue lock is not released.

Parameters
queueThe actual thread queue.
operationsThe thread queue operations.
[in,out]the_threadThe thread to extract.
[in,out]queue_contextThe thread queue context.
Returns
Returns the unblock indicator for _Thread_queue_Unblock_critical(). True indicates, that this thread must be unblocked by the scheduler later in _Thread_queue_Unblock_critical(), and false otherwise. In case false is returned, then the thread queue enqueue procedure was interrupted. Thus it will unblock itself and the thread wait information is no longer accessible, since this thread may already block on another resource in an SMP configuration.

Definition at line 565 of file threadqenqueue.c.

◆ _Thread_queue_Extract_with_proxy()

void _Thread_queue_Extract_with_proxy ( Thread_Control the_thread)

Extracts the_thread from the_thread_queue.

This routine extracts the_thread from the_thread_queue and ensures that if there is a proxy for this task on another node, it is also dealt with.

Parameters
[in,out]the_threadThe pointer to a thread control block that is to be removed

Extracts the_thread from the_thread_queue.

This routine extracts the_thread from the_thread_queue and ensures that if there is a proxy for this task on another node, it is also dealt with. A proxy is a data data that is on the thread queue on the remote node and acts as a proxy for the local thread. If the local thread was waiting on a remote operation, then the remote side of the operation must be cleaned up.

Definition at line 30 of file threadqextractwithproxy.c.

◆ _Thread_queue_First()

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.

Parameters
the_thread_queueThe thread queue.
Return values
firstThe first thread on the thread queue according to the enqueue order.
NULLNo thread is present on the thread queue.

◆ _Thread_queue_First_locked()

static __inline__ Thread_Control* _Thread_queue_First_locked ( Thread_queue_Control the_thread_queue,
const Thread_queue_Operations operations 
)
static

Returns the first thread on the thread queue if it exists, otherwise NULL.

The caller must be the owner of the thread queue lock. The thread queue lock is not released.

Parameters
the_thread_queueThe thread queue.
operationsThe thread queue operations.
Return values
firstThe first thread on the thread queue according to the enqueue order.
NULLNo thread is present on the thread queue.

Definition at line 1173 of file threadqimpl.h.

◆ _Thread_queue_Flush_critical()

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.

This function iteratively extracts the first enqueued thread of the thread queue until the thread queue is empty or the filter function indicates a stop. The thread timers of the extracted threads are cancelled. The extracted threads are unblocked.

Parameters
queueThe actual thread queue.
operationsThe thread queue operations.
filterThe filter functions is called for each thread to extract from the thread queue. It may be used to alter the thread under protection of the thread queue lock, for example to set the thread wait return code. The return value of the filter function controls if the thread queue flush operation should stop or continue.
queue_contextThe thread queue context of the lock acquire. May be used to pass additional data to the filter function via an overlay structure. The filter function should not release or acquire the thread queue lock.
Returns
The count of extracted threads.

Definition at line 63 of file threadqflush.c.

◆ _Thread_queue_Flush_default_filter()

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.

Parameters
the_threadThe thread to extract.
queueThis parameter is unused.
queue_contextThis parameter is unused.
Return values
the_threadExtract this thread.

Definition at line 26 of file threadqflush.c.

◆ _Thread_queue_Flush_status_object_was_deleted()

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.

Sets the thread wait return code of the thread to STATUS_OBJECT_WAS_DELETED

Parameters
[out]the_threadThe thread to extract.
queueThis parameter is unused.
queue_contextThis parameter is unused.
Return values
the_threadExtract this thread.

Definition at line 37 of file threadqflush.c.

◆ _Thread_queue_Flush_status_unavailable()

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.

Sets the thread wait return code of the thread to STATUS_UNAVAILABLE.

Parameters
[out]the_threadThe thread to extract.
queueThis parameter is unused.
queue_contextThis parameter is unused.
Return values
the_threadExtract this thread.

Definition at line 50 of file threadqflush.c.

◆ _Thread_queue_Gate_add()

static __inline__ void _Thread_queue_Gate_add ( Chain_Control chain,
Thread_queue_Gate gate 
)
static

Adds the gate to the chain.

Parameters
[in,out]chainThe chain to add the gate to.
gateThe gate to add to the chain.

Definition at line 481 of file threadqimpl.h.

◆ _Thread_queue_Gate_close()

static __inline__ void _Thread_queue_Gate_close ( Thread_queue_Gate gate)
static

Closes the gate.

Parameters
[out]gateThe gate to close.

Definition at line 468 of file threadqimpl.h.

◆ _Thread_queue_Gate_open()

static __inline__ void _Thread_queue_Gate_open ( Thread_queue_Gate gate)
static

Opens the gate.

Parameters
[out]gateThe gate to open.

Definition at line 494 of file threadqimpl.h.

◆ _Thread_queue_Gate_wait()

static __inline__ void _Thread_queue_Gate_wait ( Thread_queue_Gate gate)
static

Waits on a gate to open.

Performs busy waiting.

Parameters
gateThe gate to wait for.

Definition at line 508 of file threadqimpl.h.

◆ _Thread_queue_Heads_initialize()

static __inline__ void _Thread_queue_Heads_initialize ( Thread_queue_Heads heads)
static

Initializes the thread queue heads.

Parameters
[out]headsThe thread queue heads to initialize.

Definition at line 523 of file threadqimpl.h.

◆ _Thread_queue_Initialize()

void _Thread_queue_Initialize ( Thread_queue_Control the_thread_queue,
const char *  name 
)

Initializes the thread queue control to the given name.

Parameters
[out]the_thread_queueThe thread queue control to initialize.
nameThe name for the_thread_queue.

Definition at line 137 of file threadq.c.

◆ _Thread_queue_Is_empty()

static __inline__ bool _Thread_queue_Is_empty ( const Thread_queue_Queue queue)
static

Checks if the thread queue queue is empty.

Parameters
queueThe thread queue for the verification.
Return values
truequeue is empty.
falsequeue is not empty.

Definition at line 1152 of file threadqimpl.h.

◆ _Thread_queue_Object_initialize()

void _Thread_queue_Object_initialize ( Thread_queue_Control the_thread_queue)

Initializes a thread queue embedded in an object with identifier.

The object must have the layout specified by Thread_queue_Object. It should be ensured with the THREAD_QUEUE_OBJECT_ASSERT() static assertion.

Parameters
[out]the_thread_queueThe thread queue.

Definition at line 148 of file threadq.c.

◆ _Thread_queue_Path_acquire_critical()

bool _Thread_queue_Path_acquire_critical ( Thread_queue_Queue queue,
Thread_Control the_thread,
Thread_queue_Context queue_context 
)

Does nothing.

Parameters
the_proxyThis parameter is unused.
mp_idThis parameter is unused. Acquires the thread queue path in a critical section.
queueThe thread queue queue.
the_threadThe thread for the operation.
queue_contextThe thread queue context.
Return values
trueThe operation was successful.
falseThe operation failed.

Definition at line 255 of file threadqenqueue.c.

◆ _Thread_queue_Path_release_critical()

void _Thread_queue_Path_release_critical ( Thread_queue_Context queue_context)

Releases the thread queue path in a critical section.

Parameters
queue_contextThe thread queue context.

Definition at line 170 of file threadqenqueue.c.

◆ _Thread_queue_Queue_do_acquire_critical()

static __inline__ void _Thread_queue_Queue_do_acquire_critical ( Thread_queue_Queue queue,
ISR_lock_Context lock_context 
)
static

Acquires the thread queue queue in a critical section.

Parameters
queueThe thread queue queue to acquire in a critical section.
lock_statsThe lock statistics.
[out]lock_contextThe interrupt lock context.

Definition at line 567 of file threadqimpl.h.

◆ _Thread_queue_Queue_get_name_and_id()

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.

Parameters
queueThe actual thread queue.
[out]bufferThe buffer for the thread queue name copy.
buffer_sizeThe buffer size in characters.
idThe object identifier in case the thread queue is embedded in an object with identifier, otherwise it is set to 0.
Returns
The length of the thread queue name. May be greater than or equal to the buffer size if truncation occurred.

Definition at line 163 of file threadq.c.

◆ _Thread_queue_Queue_initialize()

static __inline__ void _Thread_queue_Queue_initialize ( Thread_queue_Queue queue,
const char *  name 
)
static

Initializes the thread queue queue with the given name.

Parameters
[out]queueThe thread queue queue to initialize.
nameThe name for the queue.

Definition at line 547 of file threadqimpl.h.

◆ _Thread_queue_Queue_release()

static __inline__ void _Thread_queue_Queue_release ( Thread_queue_Queue queue,
ISR_lock_Context lock_context 
)
static

Releases the thread queue queue and enables interrupts.

Parameters
queueThe thread queue queue to release.
[out]lock_contextThe interrupt lock context to enable interrupts.

Definition at line 625 of file threadqimpl.h.

◆ _Thread_queue_Queue_release_critical()

static __inline__ void _Thread_queue_Queue_release_critical ( Thread_queue_Queue queue,
ISR_lock_Context lock_context 
)
static

Releases the thread queue queue in a critical section.

Parameters
queueThe thread queue queue to release in a critical section.
[out]lock_contextThe interrupt lock context.

Definition at line 603 of file threadqimpl.h.

◆ _Thread_queue_Release()

void _Thread_queue_Release ( Thread_queue_Control the_thread_queue,
Thread_queue_Context queue_context 
)

Releases the thread queue control and enables interrupts.

Parameters
the_thread_queueThe thread queue control to release.
[out]queue_contextThe thread queue context.

Definition at line 118 of file threadq.c.

◆ _Thread_queue_Release_critical()

static __inline__ void _Thread_queue_Release_critical ( Thread_queue_Control the_thread_queue,
Thread_queue_Context queue_context 
)
static

Releases the thread queue control in a critical section.

Parameters
the_thread_queueThe thread queue control to release.
[out]queue_contextThe thread queue context.

Definition at line 764 of file threadqimpl.h.

◆ _Thread_queue_Surrender()

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.

The owner of the thread queue must be set to NULL by the caller.

This function releases the thread queue lock. In addition it performs a thread dispatch if necessary.

Parameters
[in,out]queueThe actual thread queue.
headsThe thread queue heads. It must not be NULL.
previous_ownerThe previous owner thread surrendering the thread queue.
queue_contextThe thread queue context of the lock acquire.
operationsThe thread queue operations.

Definition at line 660 of file threadqenqueue.c.

◆ _Thread_queue_Surrender_sticky()

void _Thread_queue_Surrender_sticky ( 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.

The owner of the thread queue must be set to NULL by the caller.

The caller must be the owner of the thread queue lock. This function will release the thread queue.

The thread priorities of the previous owner and the new owner are updated. The sticky level of the previous owner is decremented. A thread dispatch is performed if necessary.

Parameters
[in,out]queueThe actual thread queue.
headsThe thread queue heads. It must not be NULL.
[in,out]previous_ownerThe previous owner thread surrendering the thread queue.
queue_contextThe thread queue context of the lock acquire.
operationsThe thread queue operations.

Definition at line 708 of file threadqenqueue.c.

◆ _Thread_queue_Unblock_critical()

void _Thread_queue_Unblock_critical ( bool  unblock,
Thread_queue_Queue queue,
Thread_Control the_thread,
ISR_lock_Context lock_context 
)

Unblocks the thread which was on the thread queue before.

The caller must be the owner of the thread queue lock. This function will release the thread queue lock. Thread dispatching is disabled before the thread queue lock is released and an unblock is necessary. Thread dispatching is enabled once the sequence to unblock the thread is complete.

Parameters
unblockThe unblock indicator returned by _Thread_queue_Extract_locked().
queueThe actual thread queue.
[in,out]the_threadThe thread to extract.
[in,out]lock_contextThe lock context of the lock acquire.

Definition at line 579 of file threadqenqueue.c.

Variable Documentation

◆ _Thread_queue_Object_name

const char _Thread_queue_Object_name[]

The special thread queue name to indicated that the thread queue is embedded in an object with identifier.

See also
_Thread_queue_Object_initialize().

Definition at line 135 of file threadq.c.