1e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley/*
2fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath * Copyright (c) 2012 Niels Provos and Nick Mathewson
3e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley *
4e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * Redistribution and use in source and binary forms, with or without
5e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * modification, are permitted provided that the following conditions
6e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * are met:
7e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 1. Redistributions of source code must retain the above copyright
8e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley *    notice, this list of conditions and the following disclaimer.
9e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 2. Redistributions in binary form must reproduce the above copyright
10e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley *    notice, this list of conditions and the following disclaimer in the
11e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley *    documentation and/or other materials provided with the distribution.
12e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * 3. The name of the author may not be used to endorse or promote products
13e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley *    derived from this software without specific prior written permission.
14e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley *
15e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley */
26fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#ifndef KQUEUE_INTERNAL_H_INCLUDED_
27fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#define KQUEUE_INTERNAL_H_INCLUDED_
28e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley
29fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath/** Notification function, used to tell an event base to wake up from another
30fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath * thread.  Only works when event_kq_add_notify_event_() has previously been
31fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath * called successfully on that base. */
32fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamathint event_kq_notify_base_(struct event_base *base);
33e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley
34fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath/** Prepare a kqueue-using event base to receive notifications via an internal
35fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath * EVFILT_USER event.  Return 0 on sucess, -1 on failure.
36e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley */
37fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamathint event_kq_add_notify_event_(struct event_base *base);
38e867981d427db5e0b860d67485838e1f9e8c37daChristopher Wiley
39fc74cb45eafe51162b10a850016c6d2e1f8fd23cNarayan Kamath#endif
40