1 a3fc3b94 2023-12-19 op // This is free and unencumbered software released into the public domain.
3 a3fc3b94 2023-12-19 op // Anyone is free to copy, modify, publish, use, compile, sell, or
4 a3fc3b94 2023-12-19 op // distribute this software, either in source code form or as a compiled
5 a3fc3b94 2023-12-19 op // binary, for any purpose, commercial or non-commercial, and by any
8 a3fc3b94 2023-12-19 op // In jurisdictions that recognize copyright laws, the author or authors
9 a3fc3b94 2023-12-19 op // of this software dedicate any and all copyright interest in the
10 a3fc3b94 2023-12-19 op // software to the public domain. We make this dedication for the benefit
11 a3fc3b94 2023-12-19 op // of the public at large and to the detriment of our heirs and
12 a3fc3b94 2023-12-19 op // successors. We intend this dedication to be an overt act of
13 a3fc3b94 2023-12-19 op // relinquishment in perpetuity of all present and future rights to this
14 a3fc3b94 2023-12-19 op // software under copyright law.
16 a3fc3b94 2023-12-19 op // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 a3fc3b94 2023-12-19 op // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 a3fc3b94 2023-12-19 op // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 a3fc3b94 2023-12-19 op // IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 a3fc3b94 2023-12-19 op // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 a3fc3b94 2023-12-19 op // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 a3fc3b94 2023-12-19 op // OTHER DEALINGS IN THE SOFTWARE.
25 a3fc3b94 2023-12-19 op use unix::poll;
27 a3fc3b94 2023-12-19 op let _default = base {
31 a3fc3b94 2023-12-19 op loopbreak = &evloopbreak,
32 a3fc3b94 2023-12-19 op sigpipe = void,
37 a3fc3b94 2023-12-19 op let global = &_default;
39 a3fc3b94 2023-12-19 op export fn add(
42 a3fc3b94 2023-12-19 op f: *fn(io::file, event, nullable *opaque) void,
43 a3fc3b94 2023-12-19 op data: nullable *opaque
45 a3fc3b94 2023-12-19 op global.add(global, fd, ev, f, data);
48 a3fc3b94 2023-12-19 op export fn del(fd: io::file) void = {
49 a3fc3b94 2023-12-19 op global.del(global, fd);
52 a3fc3b94 2023-12-19 op export fn mainloop() (void | poll::error) = global.loop(global);
54 a3fc3b94 2023-12-19 op export fn loopbreak() void = {
55 a3fc3b94 2023-12-19 op global.loopbreak(global);