Lines Matching refs:mqueue
114 ipc_mqueue_t mqueue,
118 wait_queue_set_init(&mqueue->imq_set_queue, SYNC_POLICY_FIFO);
120 wait_queue_init(&mqueue->imq_wait_queue, SYNC_POLICY_FIFO);
121 ipc_kmsg_queue_init(&mqueue->imq_messages);
122 mqueue->imq_seqno = 0;
123 mqueue->imq_msgcount = 0;
124 mqueue->imq_qlimit = MACH_PORT_QLIMIT_DEFAULT;
125 mqueue->imq_fullwaiters = FALSE;
132 * Indicate whether the (port) mqueue is a member of
133 * this portset's mqueue. We do this by checking
134 * whether the portset mqueue's waitq is an member of
135 * the port's mqueue waitq.
137 * the portset's mqueue is not already a member
162 ipc_mqueue_t mqueue,
165 wait_queue_t mq_waitq = &mqueue->imq_wait_queue;
174 * Remove the mqueue from all the sets it is a member of
180 ipc_mqueue_t mqueue)
182 wait_queue_t mq_waitq = &mqueue->imq_wait_queue;
197 ipc_mqueue_t mqueue)
199 wait_queue_set_t mq_setq = &mqueue->imq_set_queue;
209 * Associate the portset's mqueue with the port's mqueue.
212 * mqueue and messages on the port mqueue, try to match them
254 /* waitq/mqueue still locked, thread locked */
315 ipc_mqueue_t mqueue)
318 &mqueue->imq_wait_queue,
346 ipc_mqueue_t mqueue,
361 imq_lock(mqueue);
363 if (!imq_full(mqueue) ||
364 (!imq_full_kernel(mqueue) &&
368 mqueue->imq_msgcount++;
369 assert(mqueue->imq_msgcount > 0);
370 imq_unlock(mqueue);
380 imq_unlock(mqueue);
384 if (imq_full_kernel(mqueue)) {
385 imq_unlock(mqueue);
389 mqueue->imq_fullwaiters = TRUE;
396 &mqueue->imq_wait_queue,
401 imq_unlock(mqueue);
416 assert(mqueue->imq_msgcount > 0);
428 ipc_mqueue_post(mqueue, kmsg);
444 ipc_mqueue_t mqueue)
446 assert(imq_held(mqueue));
447 assert(mqueue->imq_msgcount > 1 || ipc_kmsg_queue_empty(&mqueue->imq_messages));
449 mqueue->imq_msgcount--;
451 if (!imq_full(mqueue) && mqueue->imq_fullwaiters) {
453 &mqueue->imq_wait_queue,
457 mqueue->imq_fullwaiters = FALSE;
460 mqueue->imq_msgcount++;
477 register ipc_mqueue_t mqueue,
490 imq_lock(mqueue);
492 wait_queue_t waitq = &mqueue->imq_wait_queue;
506 assert(mqueue->imq_msgcount > 0);
507 ipc_kmsg_enqueue_macro(&mqueue->imq_messages, kmsg);
534 receiver->ith_seqno = mqueue->imq_seqno++;
538 ipc_mqueue_release_msgcount(mqueue);
552 imq_unlock(mqueue);
653 ipc_mqueue_t mqueue,
671 imq_lock(mqueue);
674 if (imq_is_set(mqueue)) {
679 q = &mqueue->imq_setlinks;
682 * If we are waiting on a portset mqueue, we need to see if
685 * mqueue lock during the search, we tie up any attempts by
699 imq_unlock(mqueue);
703 imq_lock(mqueue);
723 imq_unlock(mqueue);
752 kmsgs = &mqueue->imq_messages;
754 ipc_mqueue_select(mqueue, option, max_size);
755 imq_unlock(mqueue);
777 * Looks like we'll have to block. The mqueue we will
783 imq_unlock(mqueue);
800 wresult = wait_queue_assert_wait64_locked(&mqueue->imq_wait_queue,
805 imq_unlock(mqueue);
830 * mqueue locked.
838 ipc_mqueue_t mqueue,
854 kmsg = ipc_kmsg_queue_first(&mqueue->imq_messages);
875 ipc_kmsg_rmqueue_first_macro(&mqueue->imq_messages, kmsg);
876 ipc_mqueue_release_msgcount(mqueue);
877 self->ith_seqno = mqueue->imq_seqno++;
896 ipc_mqueue_t mqueue)
904 imq_lock(mqueue);
908 mqueue->imq_fullwaiters = FALSE;
910 &mqueue->imq_wait_queue,
915 kmqueue = &mqueue->imq_messages;
918 imq_unlock(mqueue);
924 imq_lock(mqueue);
926 imq_unlock(mqueue);
941 ipc_mqueue_t mqueue,
950 imq_lock(mqueue);
951 if (qlimit > mqueue->imq_qlimit) {
955 wakeup = qlimit - mqueue->imq_qlimit;
959 &mqueue->imq_wait_queue,
963 mqueue->imq_fullwaiters = FALSE;
966 mqueue->imq_msgcount++; /* give it to the awakened thread */
969 mqueue->imq_qlimit = qlimit;
970 imq_unlock(mqueue);
977 * Changes an mqueue's sequence number.
983 ipc_mqueue_t mqueue,
989 imq_lock(mqueue);
990 mqueue->imq_seqno = seqno;
991 imq_unlock(mqueue);
1022 ipc_mqueue_t mqueue;
1049 mqueue = &port->ip_messages;
1062 mqueue = &pset->ips_messages;
1070 * the space is unlocked, and mqueue is initialized.
1077 *mqueuep = mqueue;