1 #ifndef _KERN_MPQUEUE_H
2 #define _KERN_MPQUEUE_H
3 #include <kern/locks.h>
7 #ifdef MACH_KERNEL_PRIVATE
9 /*----------------------------------------------------------------*/
11 * Define macros for queues with locks.
14 struct queue_entry head
; /* header for queue */
15 uint64_t earliest_soft_deadline
;
18 #if defined(__i386__) || defined(__x86_64__)
19 lck_mtx_ext_t lock_data_ext
;
23 typedef struct mpqueue_head mpqueue_head_t
;
25 #define round_mpq(size) (size)
28 #if defined(__i386__) || defined(__x86_64__)
30 #define mpqueue_init(q, lck_grp, lck_attr) \
32 queue_init(&(q)->head); \
33 lck_mtx_init_ext(&(q)->lock_data, \
34 &(q)->lock_data_ext, \
37 (q)->earliest_soft_deadline = UINT64_MAX; \
43 #define mpqueue_init(q, lck_grp, lck_attr) \
45 queue_init(&(q)->head); \
46 lck_mtx_init(&(q)->lock_data, \
53 #define mpenqueue_tail(q, elt) \
55 lck_mtx_lock_spin_always(&(q)->lock_data); \
56 enqueue_tail(&(q)->head, elt); \
57 lck_mtx_unlock_always(&(q)->lock_data); \
60 #define mpdequeue_head(q, elt) \
62 lck_mtx_lock_spin_always(&(q)->lock_data); \
63 if (queue_empty(&(q)->head)) \
66 *(elt) = dequeue_head(&(q)->head); \
67 lck_mtx_unlock_always(&(q)->lock_data); \
70 #endif /* MACH_KERNEL_PRIVATE */
75 #endif /* _KERN_QUEUE_H */