LCOV - code coverage report
Current view: top level - /home/runner/zephyrproject/zephyr/kernel/include - wait_q.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 5 5
Test Date: 2026-01-27 12:19:34 Functions: 100.0 % 2 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* wait queue for multiple threads on kernel objects */
       2                 :             : 
       3                 :             : /*
       4                 :             :  * Copyright (c) 2015 Wind River Systems, Inc.
       5                 :             :  *
       6                 :             :  * SPDX-License-Identifier: Apache-2.0
       7                 :             :  */
       8                 :             : 
       9                 :             : #ifndef ZEPHYR_KERNEL_INCLUDE_WAIT_Q_H_
      10                 :             : #define ZEPHYR_KERNEL_INCLUDE_WAIT_Q_H_
      11                 :             : 
      12                 :             : #include <zephyr/kernel_structs.h>
      13                 :             : #include <zephyr/sys/dlist.h>
      14                 :             : #include <zephyr/sys/rb.h>
      15                 :             : #include <timeout_q.h>
      16                 :             : #include <priority_q.h>
      17                 :             : 
      18                 :             : #ifdef __cplusplus
      19                 :             : extern "C" {
      20                 :             : #endif
      21                 :             : 
      22                 :             : #ifdef CONFIG_WAITQ_SCALABLE
      23                 :             : 
      24                 :             : #define _WAIT_Q_FOR_EACH(wq, thread_ptr) \
      25                 :             :         RB_FOR_EACH_CONTAINER(&(wq)->waitq.tree, thread_ptr, base.qnode_rb)
      26                 :             : 
      27                 :             : static inline void z_waitq_init(_wait_q_t *w)
      28                 :             : {
      29                 :             :         w->waitq = (struct _priq_rb) {
      30                 :             :                 .tree = {
      31                 :             :                         .lessthan_fn = z_priq_rb_lessthan
      32                 :             :                 }
      33                 :             :         };
      34                 :             : }
      35                 :             : 
      36                 :             : static inline struct k_thread *z_waitq_head(_wait_q_t *w)
      37                 :             : {
      38                 :             :         return (struct k_thread *)rb_get_min(&w->waitq.tree);
      39                 :             : }
      40                 :             : 
      41                 :             : #else /* !CONFIG_WAITQ_SCALABLE: */
      42                 :             : 
      43                 :             : #define _WAIT_Q_FOR_EACH(wq, thread_ptr) \
      44                 :             :         SYS_DLIST_FOR_EACH_CONTAINER(&((wq)->waitq), thread_ptr, \
      45                 :             :                                      base.qnode_dlist)
      46                 :             : 
      47                 :          48 : static inline void z_waitq_init(_wait_q_t *w)
      48                 :             : {
      49                 :          48 :         sys_dlist_init(&w->waitq);
      50                 :          48 : }
      51                 :             : 
      52                 :          52 : static inline struct k_thread *z_waitq_head(_wait_q_t *w)
      53                 :             : {
      54                 :          52 :         return (struct k_thread *)sys_dlist_peek_head(&w->waitq);
      55                 :             : }
      56                 :             : 
      57                 :             : #endif /* !CONFIG_WAITQ_SCALABLE */
      58                 :             : 
      59                 :             : #ifdef __cplusplus
      60                 :             : }
      61                 :             : #endif
      62                 :             : 
      63                 :             : #endif /* ZEPHYR_KERNEL_INCLUDE_WAIT_Q_H_ */
        

Generated by: LCOV version 2.0-1