Lines Matching refs:mq
38 a_prefix##init(a_mq_type *mq) { \
40 if (mtx_init(&mq->lock)) \
42 ql_new(&mq->msgs); \
43 mq->count = 0; \
47 a_prefix##fini(a_mq_type *mq) \
50 mtx_fini(&mq->lock); \
53 a_prefix##count(a_mq_type *mq) \
57 mtx_lock(&mq->lock); \
58 count = mq->count; \
59 mtx_unlock(&mq->lock); \
63 a_prefix##tryget(a_mq_type *mq) \
67 mtx_lock(&mq->lock); \
68 msg = ql_first(&mq->msgs); \
70 ql_head_remove(&mq->msgs, a_mq_msg_type, a_field); \
71 mq->count--; \
73 mtx_unlock(&mq->lock); \
77 a_prefix##get(a_mq_type *mq) \
82 msg = a_prefix##tryget(mq); \
89 msg = a_prefix##tryget(mq); \
101 a_prefix##put(a_mq_type *mq, a_mq_msg_type *msg) \
104 mtx_lock(&mq->lock); \
106 ql_tail_insert(&mq->msgs, msg, a_field); \
107 mq->count++; \
108 mtx_unlock(&mq->lock); \