1/*
2 * Copyright (c) 2012, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef CAPQUEUE_H
11#define CAPQUEUE_H
12
13#include <stdbool.h>
14#include <barrelfish/event_queue.h>
15
16struct capqueue_queue {
17    struct event_queue queues[2];
18    struct event_queue_node queue_end;
19    bool on_first, running, retrigger;
20};
21
22static inline void
23capqueue_wait(struct capqueue_queue *q, struct event_queue_node *qn,
24             struct event_closure event)
25{
26    event_queue_add(&q->queues[!q->on_first], qn, event);
27}
28
29void capqueue_notify(struct capqueue_queue *q);
30
31void capqueue_init(struct capqueue_queue *q, struct waitset *ws);
32
33#endif
34