asyncengine 0.0.1.testing
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +0 -0
- data/asyncengine.gemspec +26 -0
- data/ext/asyncengine_ext/asyncengine_ruby.c +82 -0
- data/ext/asyncengine_ext/extconf.rb +47 -0
- data/ext/asyncengine_ext/libuv/AUTHORS +45 -0
- data/ext/asyncengine_ext/libuv/LICENSE +42 -0
- data/ext/asyncengine_ext/libuv/Makefile +119 -0
- data/ext/asyncengine_ext/libuv/README.md +88 -0
- data/ext/asyncengine_ext/libuv/build/gcc_version.py +20 -0
- data/ext/asyncengine_ext/libuv/common.gypi +176 -0
- data/ext/asyncengine_ext/libuv/config-mingw.mk +61 -0
- data/ext/asyncengine_ext/libuv/config-unix.mk +173 -0
- data/ext/asyncengine_ext/libuv/gyp_uv +60 -0
- data/ext/asyncengine_ext/libuv/include/ares.h +591 -0
- data/ext/asyncengine_ext/libuv/include/ares_version.h +24 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/eio.h +403 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ev.h +838 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ngx-queue.h +106 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/tree.h +768 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-unix.h +256 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-win.h +458 -0
- data/ext/asyncengine_ext/libuv/include/uv.h +1556 -0
- data/ext/asyncengine_ext/libuv/src/ares/AUTHORS +37 -0
- data/ext/asyncengine_ext/libuv/src/ares/CHANGES +1218 -0
- data/ext/asyncengine_ext/libuv/src/ares/CMakeLists.txt +22 -0
- data/ext/asyncengine_ext/libuv/src/ares/NEWS +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/README +60 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.cares +13 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.msvc +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.node +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/RELEASE-NOTES +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/TODO +23 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__close_sockets.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__get_hostent.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__read_line.c +71 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__timeval.c +111 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_cancel.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.c +190 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.h +65 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_destroy.c +105 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_dns.h +90 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_name.c +200 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_string.c +75 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_fds.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_hostent.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_string.c +25 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.c +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyaddr.c +301 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyname.c +523 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getnameinfo.c +427 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.c +122 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.h +53 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getsock.c +72 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_init.c +1809 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_iphlpapi.h +221 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_ipv6.h +78 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.c +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.c +86 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_mkquery.c +195 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.c +181 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.h +55 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_options.c +248 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_a_reply.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_aaaa_reply.c +259 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_mx_reply.c +170 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ns_reply.c +182 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ptr_reply.c +217 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_srv_reply.c +179 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_txt_reply.c +201 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.c +11035 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.h +43 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_private.h +355 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_process.c +1295 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_query.c +183 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_rules.h +144 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_search.c +321 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_send.c +134 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_setup.h +199 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.h +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strerror.c +56 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_timeout.c +80 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_version.c +11 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.c +79 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.h +36 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.c +59 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_cygwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_darwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_freebsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_linux/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_netbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_openbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_sunos/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_win32/ares_config.h +369 -0
- data/ext/asyncengine_ext/libuv/src/ares/get_ver.awk +35 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.c +451 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.h +31 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.c +208 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/nameser.h +203 -0
- data/ext/asyncengine_ext/libuv/src/ares/setup_once.h +504 -0
- data/ext/asyncengine_ext/libuv/src/ares/windows_port.c +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/async.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/cares.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/check.c +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/core.c +588 -0
- data/ext/asyncengine_ext/libuv/src/unix/cygwin.c +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/darwin.c +341 -0
- data/ext/asyncengine_ext/libuv/src/unix/dl.c +91 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Changes +63 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Makefile.am +15 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/autogen.sh +3 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config.h.in +86 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_cygwin.h +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_darwin.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_freebsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_linux.h +94 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_netbsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_openbsd.h +137 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_sunos.h +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/configure.ac +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/demo.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/ecb.h +370 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.3 +3428 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.c +2593 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.pod +969 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/libeio.m4 +195 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/xthread.h +164 -0
- data/ext/asyncengine_ext/libuv/src/unix/error.c +98 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Changes +388 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.am +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.in +771 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/README +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/autogen.sh +6 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.guess +1526 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.h.in +125 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.sub +1658 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_cygwin.h +123 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_darwin.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_freebsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_linux.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_netbsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_openbsd.h +126 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_sunos.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure +13037 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure.ac +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/depcomp +630 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev++.h +816 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.3 +5311 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.c +3921 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.pod +5243 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_epoll.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_poll.c +148 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_port.c +179 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_select.c +310 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_vars.h +203 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_win32.c +153 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_wrap.h +196 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.c +402 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.h +170 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/install-sh +294 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/libev.m4 +39 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ltmain.sh +8413 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/missing +336 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/mkinstalldirs +111 -0
- data/ext/asyncengine_ext/libuv/src/unix/freebsd.c +312 -0
- data/ext/asyncengine_ext/libuv/src/unix/fs.c +707 -0
- data/ext/asyncengine_ext/libuv/src/unix/idle.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/internal.h +161 -0
- data/ext/asyncengine_ext/libuv/src/unix/kqueue.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/core.c +474 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/inotify.c +211 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.c +230 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.h +87 -0
- data/ext/asyncengine_ext/libuv/src/unix/loop.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/netbsd.c +108 -0
- data/ext/asyncengine_ext/libuv/src/unix/openbsd.c +295 -0
- data/ext/asyncengine_ext/libuv/src/unix/pipe.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/prepare.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/process.c +369 -0
- data/ext/asyncengine_ext/libuv/src/unix/stream.c +1033 -0
- data/ext/asyncengine_ext/libuv/src/unix/sunos.c +466 -0
- data/ext/asyncengine_ext/libuv/src/unix/tcp.c +327 -0
- data/ext/asyncengine_ext/libuv/src/unix/thread.c +154 -0
- data/ext/asyncengine_ext/libuv/src/unix/timer.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/tty.c +146 -0
- data/ext/asyncengine_ext/libuv/src/unix/udp.c +670 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.c +124 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.h +13 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.c +354 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.h +87 -0
- data/ext/asyncengine_ext/libuv/src/win/async.c +127 -0
- data/ext/asyncengine_ext/libuv/src/win/cares.c +290 -0
- data/ext/asyncengine_ext/libuv/src/win/core.c +270 -0
- data/ext/asyncengine_ext/libuv/src/win/dl.c +82 -0
- data/ext/asyncengine_ext/libuv/src/win/error.c +132 -0
- data/ext/asyncengine_ext/libuv/src/win/fs-event.c +514 -0
- data/ext/asyncengine_ext/libuv/src/win/fs.c +1576 -0
- data/ext/asyncengine_ext/libuv/src/win/getaddrinfo.c +372 -0
- data/ext/asyncengine_ext/libuv/src/win/handle.c +225 -0
- data/ext/asyncengine_ext/libuv/src/win/internal.h +352 -0
- data/ext/asyncengine_ext/libuv/src/win/loop-watcher.c +131 -0
- data/ext/asyncengine_ext/libuv/src/win/pipe.c +1661 -0
- data/ext/asyncengine_ext/libuv/src/win/process.c +1140 -0
- data/ext/asyncengine_ext/libuv/src/win/req.c +174 -0
- data/ext/asyncengine_ext/libuv/src/win/stream.c +201 -0
- data/ext/asyncengine_ext/libuv/src/win/tcp.c +1282 -0
- data/ext/asyncengine_ext/libuv/src/win/thread.c +332 -0
- data/ext/asyncengine_ext/libuv/src/win/threadpool.c +73 -0
- data/ext/asyncengine_ext/libuv/src/win/timer.c +276 -0
- data/ext/asyncengine_ext/libuv/src/win/tty.c +1795 -0
- data/ext/asyncengine_ext/libuv/src/win/udp.c +709 -0
- data/ext/asyncengine_ext/libuv/src/win/util.c +719 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.c +117 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.h +4419 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.c +470 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.h +138 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ares.c +118 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-list.h +105 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ping-pongs.c +213 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pound.c +324 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pump.c +462 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-sizes.c +40 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-spawn.c +156 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
- data/ext/asyncengine_ext/libuv/test/blackhole-server.c +118 -0
- data/ext/asyncengine_ext/libuv/test/dns-server.c +321 -0
- data/ext/asyncengine_ext/libuv/test/echo-server.c +370 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/asyncengine_ext/libuv/test/run-benchmarks.c +64 -0
- data/ext/asyncengine_ext/libuv/test/run-tests.c +108 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.c +315 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.h +36 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.c +343 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.h +42 -0
- data/ext/asyncengine_ext/libuv/test/runner.c +317 -0
- data/ext/asyncengine_ext/libuv/test/runner.h +159 -0
- data/ext/asyncengine_ext/libuv/test/task.h +117 -0
- data/ext/asyncengine_ext/libuv/test/test-async.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-callback-stack.c +203 -0
- data/ext/asyncengine_ext/libuv/test/test-connection-fail.c +148 -0
- data/ext/asyncengine_ext/libuv/test/test-counters-init.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-cwd-and-chdir.c +64 -0
- data/ext/asyncengine_ext/libuv/test/test-delayed-accept.c +197 -0
- data/ext/asyncengine_ext/libuv/test/test-dlerror.c +49 -0
- data/ext/asyncengine_ext/libuv/test/test-eio-overflow.c +90 -0
- data/ext/asyncengine_ext/libuv/test/test-error.c +59 -0
- data/ext/asyncengine_ext/libuv/test/test-fail-always.c +29 -0
- data/ext/asyncengine_ext/libuv/test/test-fs-event.c +442 -0
- data/ext/asyncengine_ext/libuv/test/test-fs.c +1731 -0
- data/ext/asyncengine_ext/libuv/test/test-get-currentexe.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-get-loadavg.c +36 -0
- data/ext/asyncengine_ext/libuv/test/test-get-memory.c +38 -0
- data/ext/asyncengine_ext/libuv/test/test-getaddrinfo.c +122 -0
- data/ext/asyncengine_ext/libuv/test/test-gethostbyname.c +189 -0
- data/ext/asyncengine_ext/libuv/test/test-getsockname.c +342 -0
- data/ext/asyncengine_ext/libuv/test/test-hrtime.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-idle.c +81 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc-send-recv.c +209 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc.c +614 -0
- data/ext/asyncengine_ext/libuv/test/test-list.h +371 -0
- data/ext/asyncengine_ext/libuv/test/test-loop-handles.c +359 -0
- data/ext/asyncengine_ext/libuv/test/test-multiple-listen.c +102 -0
- data/ext/asyncengine_ext/libuv/test/test-mutexes.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-pass-always.c +28 -0
- data/ext/asyncengine_ext/libuv/test/test-ping-pong.c +253 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-bind-error.c +140 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-connect-error.c +96 -0
- data/ext/asyncengine_ext/libuv/test/test-platform-output.c +87 -0
- data/ext/asyncengine_ext/libuv/test/test-process-title.c +42 -0
- data/ext/asyncengine_ext/libuv/test/test-ref.c +322 -0
- data/ext/asyncengine_ext/libuv/test/test-run-once.c +44 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-close.c +103 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-spawn.c +499 -0
- data/ext/asyncengine_ext/libuv/test/test-stdio-over-pipes.c +256 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind-error.c +191 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind6-error.c +154 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-close.c +129 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect-error.c +70 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect6-error.c +68 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-flags.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-error.c +168 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-writealot.c +195 -0
- data/ext/asyncengine_ext/libuv/test/test-thread.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-threadpool.c +57 -0
- data/ext/asyncengine_ext/libuv/test/test-timer-again.c +141 -0
- data/ext/asyncengine_ext/libuv/test/test-timer.c +130 -0
- data/ext/asyncengine_ext/libuv/test/test-tty.c +110 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-dgram-too-big.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-ipv6.c +156 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-join.c +139 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-ttl.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-options.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-send-and-recv.c +208 -0
- data/ext/asyncengine_ext/libuv/test/test-util.c +97 -0
- data/ext/asyncengine_ext/libuv/uv.gyp +435 -0
- data/ext/asyncengine_ext/libuv/vcbuild.bat +105 -0
- data/lib/asyncengine/version.rb +3 -0
- data/lib/asyncengine.rb +41 -0
- metadata +384 -0
@@ -0,0 +1,402 @@
|
|
1
|
+
/*
|
2
|
+
* libevent compatibility layer
|
3
|
+
*
|
4
|
+
* Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without modifica-
|
8
|
+
* tion, are permitted provided that the following conditions are met:
|
9
|
+
*
|
10
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
* this list of conditions and the following disclaimer.
|
12
|
+
*
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in the
|
15
|
+
* documentation and/or other materials provided with the distribution.
|
16
|
+
*
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
18
|
+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
19
|
+
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
20
|
+
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
|
21
|
+
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
23
|
+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
24
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
|
25
|
+
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
26
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
*
|
28
|
+
* Alternatively, the contents of this file may be used under the terms of
|
29
|
+
* the GNU General Public License ("GPL") version 2 or any later version,
|
30
|
+
* in which case the provisions of the GPL are applicable instead of
|
31
|
+
* the above. If you wish to allow the use of your version of this file
|
32
|
+
* only under the terms of the GPL and not to allow others to use your
|
33
|
+
* version of this file under the BSD license, indicate your decision
|
34
|
+
* by deleting the provisions above and replace them with the notice
|
35
|
+
* and other provisions required by the GPL. If you do not delete the
|
36
|
+
* provisions above, a recipient may use your version of this file under
|
37
|
+
* either the BSD or the GPL.
|
38
|
+
*/
|
39
|
+
|
40
|
+
#include <stddef.h>
|
41
|
+
#include <stdlib.h>
|
42
|
+
#include <assert.h>
|
43
|
+
|
44
|
+
#ifdef EV_EVENT_H
|
45
|
+
# include EV_EVENT_H
|
46
|
+
#else
|
47
|
+
# include "event.h"
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#if EV_MULTIPLICITY
|
51
|
+
# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base
|
52
|
+
# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base
|
53
|
+
#else
|
54
|
+
# define dLOOPev
|
55
|
+
# define dLOOPbase
|
56
|
+
#endif
|
57
|
+
|
58
|
+
/* never accessed, will always be cast from/to ev_loop */
|
59
|
+
struct event_base
|
60
|
+
{
|
61
|
+
int dummy;
|
62
|
+
};
|
63
|
+
|
64
|
+
static struct event_base *ev_x_cur;
|
65
|
+
|
66
|
+
static ev_tstamp
|
67
|
+
ev_tv_get (struct timeval *tv)
|
68
|
+
{
|
69
|
+
if (tv)
|
70
|
+
{
|
71
|
+
ev_tstamp after = tv->tv_sec + tv->tv_usec * 1e-6;
|
72
|
+
return after ? after : 1e-6;
|
73
|
+
}
|
74
|
+
else
|
75
|
+
return -1.;
|
76
|
+
}
|
77
|
+
|
78
|
+
#define EVENT_STRINGIFY(s) # s
|
79
|
+
#define EVENT_VERSION(a,b) EVENT_STRINGIFY (a) "." EVENT_STRINGIFY (b)
|
80
|
+
|
81
|
+
const char *event_get_version (void)
|
82
|
+
{
|
83
|
+
/* returns ABI, not API or library, version */
|
84
|
+
return EVENT_VERSION (EV_VERSION_MAJOR, EV_VERSION_MINOR);
|
85
|
+
}
|
86
|
+
|
87
|
+
const char *event_get_method (void)
|
88
|
+
{
|
89
|
+
return "libev";
|
90
|
+
}
|
91
|
+
|
92
|
+
void *event_init (void)
|
93
|
+
{
|
94
|
+
#if EV_MULTIPLICITY
|
95
|
+
if (ev_x_cur)
|
96
|
+
ev_x_cur = (struct event_base *)ev_loop_new (EVFLAG_AUTO);
|
97
|
+
else
|
98
|
+
ev_x_cur = (struct event_base *)ev_default_loop (EVFLAG_AUTO);
|
99
|
+
#else
|
100
|
+
assert (("libev: multiple event bases not supported when not compiled with EV_MULTIPLICITY", !ev_x_cur));
|
101
|
+
|
102
|
+
ev_x_cur = (struct event_base *)(long)ev_default_loop (EVFLAG_AUTO);
|
103
|
+
#endif
|
104
|
+
|
105
|
+
return ev_x_cur;
|
106
|
+
}
|
107
|
+
|
108
|
+
void event_base_free (struct event_base *base)
|
109
|
+
{
|
110
|
+
dLOOPbase;
|
111
|
+
|
112
|
+
#if EV_MULTIPLICITY
|
113
|
+
if (!ev_is_default_loop (loop))
|
114
|
+
ev_loop_destroy (loop);
|
115
|
+
#endif
|
116
|
+
}
|
117
|
+
|
118
|
+
int event_dispatch (void)
|
119
|
+
{
|
120
|
+
return event_base_dispatch (ev_x_cur);
|
121
|
+
}
|
122
|
+
|
123
|
+
#ifdef EV_STANDALONE
|
124
|
+
void event_set_log_callback (event_log_cb cb)
|
125
|
+
{
|
126
|
+
/* nop */
|
127
|
+
}
|
128
|
+
#endif
|
129
|
+
|
130
|
+
int event_loop (int flags)
|
131
|
+
{
|
132
|
+
return event_base_loop (ev_x_cur, flags);
|
133
|
+
}
|
134
|
+
|
135
|
+
int event_loopexit (struct timeval *tv)
|
136
|
+
{
|
137
|
+
return event_base_loopexit (ev_x_cur, tv);
|
138
|
+
}
|
139
|
+
|
140
|
+
static void
|
141
|
+
ev_x_cb (struct event *ev, int revents)
|
142
|
+
{
|
143
|
+
revents &= EV_READ | EV_WRITE | EV_TIMER | EV_SIGNAL;
|
144
|
+
|
145
|
+
ev->ev_res = revents;
|
146
|
+
ev->ev_callback (ev->ev_fd, (short)revents, ev->ev_arg);
|
147
|
+
}
|
148
|
+
|
149
|
+
static void
|
150
|
+
ev_x_cb_sig (EV_P_ struct ev_signal *w, int revents)
|
151
|
+
{
|
152
|
+
struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.sig));
|
153
|
+
|
154
|
+
if (revents & EV_ERROR)
|
155
|
+
event_del (ev);
|
156
|
+
|
157
|
+
ev_x_cb (ev, revents);
|
158
|
+
}
|
159
|
+
|
160
|
+
static void
|
161
|
+
ev_x_cb_io (EV_P_ struct ev_io *w, int revents)
|
162
|
+
{
|
163
|
+
struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, iosig.io));
|
164
|
+
|
165
|
+
if ((revents & EV_ERROR) || !(ev->ev_events & EV_PERSIST))
|
166
|
+
event_del (ev);
|
167
|
+
|
168
|
+
ev_x_cb (ev, revents);
|
169
|
+
}
|
170
|
+
|
171
|
+
static void
|
172
|
+
ev_x_cb_to (EV_P_ struct ev_timer *w, int revents)
|
173
|
+
{
|
174
|
+
struct event *ev = (struct event *)(((char *)w) - offsetof (struct event, to));
|
175
|
+
|
176
|
+
event_del (ev);
|
177
|
+
|
178
|
+
ev_x_cb (ev, revents);
|
179
|
+
}
|
180
|
+
|
181
|
+
void event_set (struct event *ev, int fd, short events, void (*cb)(int, short, void *), void *arg)
|
182
|
+
{
|
183
|
+
if (events & EV_SIGNAL)
|
184
|
+
ev_init (&ev->iosig.sig, ev_x_cb_sig);
|
185
|
+
else
|
186
|
+
ev_init (&ev->iosig.io, ev_x_cb_io);
|
187
|
+
|
188
|
+
ev_init (&ev->to, ev_x_cb_to);
|
189
|
+
|
190
|
+
ev->ev_base = ev_x_cur; /* not threadsafe, but it's how libevent works */
|
191
|
+
ev->ev_fd = fd;
|
192
|
+
ev->ev_events = events;
|
193
|
+
ev->ev_pri = 0;
|
194
|
+
ev->ev_callback = cb;
|
195
|
+
ev->ev_arg = arg;
|
196
|
+
ev->ev_res = 0;
|
197
|
+
ev->ev_flags = EVLIST_INIT;
|
198
|
+
}
|
199
|
+
|
200
|
+
int event_once (int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv)
|
201
|
+
{
|
202
|
+
return event_base_once (ev_x_cur, fd, events, cb, arg, tv);
|
203
|
+
}
|
204
|
+
|
205
|
+
int event_add (struct event *ev, struct timeval *tv)
|
206
|
+
{
|
207
|
+
dLOOPev;
|
208
|
+
|
209
|
+
if (ev->ev_events & EV_SIGNAL)
|
210
|
+
{
|
211
|
+
if (!ev_is_active (&ev->iosig.sig))
|
212
|
+
{
|
213
|
+
ev_signal_set (&ev->iosig.sig, ev->ev_fd);
|
214
|
+
ev_signal_start (EV_A_ &ev->iosig.sig);
|
215
|
+
|
216
|
+
ev->ev_flags |= EVLIST_SIGNAL;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
else if (ev->ev_events & (EV_READ | EV_WRITE))
|
220
|
+
{
|
221
|
+
if (!ev_is_active (&ev->iosig.io))
|
222
|
+
{
|
223
|
+
ev_io_set (&ev->iosig.io, ev->ev_fd, ev->ev_events & (EV_READ | EV_WRITE));
|
224
|
+
ev_io_start (EV_A_ &ev->iosig.io);
|
225
|
+
|
226
|
+
ev->ev_flags |= EVLIST_INSERTED;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
if (tv)
|
231
|
+
{
|
232
|
+
ev->to.repeat = ev_tv_get (tv);
|
233
|
+
ev_timer_again (EV_A_ &ev->to);
|
234
|
+
ev->ev_flags |= EVLIST_TIMEOUT;
|
235
|
+
}
|
236
|
+
else
|
237
|
+
{
|
238
|
+
ev_timer_stop (EV_A_ &ev->to);
|
239
|
+
ev->ev_flags &= ~EVLIST_TIMEOUT;
|
240
|
+
}
|
241
|
+
|
242
|
+
ev->ev_flags |= EVLIST_ACTIVE;
|
243
|
+
|
244
|
+
return 0;
|
245
|
+
}
|
246
|
+
|
247
|
+
int event_del (struct event *ev)
|
248
|
+
{
|
249
|
+
dLOOPev;
|
250
|
+
|
251
|
+
if (ev->ev_events & EV_SIGNAL)
|
252
|
+
ev_signal_stop (EV_A_ &ev->iosig.sig);
|
253
|
+
else if (ev->ev_events & (EV_READ | EV_WRITE))
|
254
|
+
ev_io_stop (EV_A_ &ev->iosig.io);
|
255
|
+
|
256
|
+
if (ev_is_active (&ev->to))
|
257
|
+
ev_timer_stop (EV_A_ &ev->to);
|
258
|
+
|
259
|
+
ev->ev_flags = EVLIST_INIT;
|
260
|
+
|
261
|
+
return 0;
|
262
|
+
}
|
263
|
+
|
264
|
+
void event_active (struct event *ev, int res, short ncalls)
|
265
|
+
{
|
266
|
+
dLOOPev;
|
267
|
+
|
268
|
+
if (res & EV_TIMEOUT)
|
269
|
+
ev_feed_event (EV_A_ &ev->to, res & EV_TIMEOUT);
|
270
|
+
|
271
|
+
if (res & EV_SIGNAL)
|
272
|
+
ev_feed_event (EV_A_ &ev->iosig.sig, res & EV_SIGNAL);
|
273
|
+
|
274
|
+
if (res & (EV_READ | EV_WRITE))
|
275
|
+
ev_feed_event (EV_A_ &ev->iosig.io, res & (EV_READ | EV_WRITE));
|
276
|
+
}
|
277
|
+
|
278
|
+
int event_pending (struct event *ev, short events, struct timeval *tv)
|
279
|
+
{
|
280
|
+
short revents = 0;
|
281
|
+
dLOOPev;
|
282
|
+
|
283
|
+
if (ev->ev_events & EV_SIGNAL)
|
284
|
+
{
|
285
|
+
/* sig */
|
286
|
+
if (ev_is_active (&ev->iosig.sig) || ev_is_pending (&ev->iosig.sig))
|
287
|
+
revents |= EV_SIGNAL;
|
288
|
+
}
|
289
|
+
else if (ev->ev_events & (EV_READ | EV_WRITE))
|
290
|
+
{
|
291
|
+
/* io */
|
292
|
+
if (ev_is_active (&ev->iosig.io) || ev_is_pending (&ev->iosig.io))
|
293
|
+
revents |= ev->ev_events & (EV_READ | EV_WRITE);
|
294
|
+
}
|
295
|
+
|
296
|
+
if (ev->ev_events & EV_TIMEOUT || ev_is_active (&ev->to) || ev_is_pending (&ev->to))
|
297
|
+
{
|
298
|
+
revents |= EV_TIMEOUT;
|
299
|
+
|
300
|
+
if (tv)
|
301
|
+
{
|
302
|
+
ev_tstamp at = ev_now (EV_A);
|
303
|
+
|
304
|
+
tv->tv_sec = (long)at;
|
305
|
+
tv->tv_usec = (long)((at - (ev_tstamp)tv->tv_sec) * 1e6);
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
return events & revents;
|
310
|
+
}
|
311
|
+
|
312
|
+
int event_priority_init (int npri)
|
313
|
+
{
|
314
|
+
return event_base_priority_init (ev_x_cur, npri);
|
315
|
+
}
|
316
|
+
|
317
|
+
int event_priority_set (struct event *ev, int pri)
|
318
|
+
{
|
319
|
+
ev->ev_pri = pri;
|
320
|
+
|
321
|
+
return 0;
|
322
|
+
}
|
323
|
+
|
324
|
+
int event_base_set (struct event_base *base, struct event *ev)
|
325
|
+
{
|
326
|
+
ev->ev_base = base;
|
327
|
+
|
328
|
+
return 0;
|
329
|
+
}
|
330
|
+
|
331
|
+
int event_base_loop (struct event_base *base, int flags)
|
332
|
+
{
|
333
|
+
dLOOPbase;
|
334
|
+
|
335
|
+
ev_run (EV_A_ flags);
|
336
|
+
|
337
|
+
return 0;
|
338
|
+
}
|
339
|
+
|
340
|
+
int event_base_dispatch (struct event_base *base)
|
341
|
+
{
|
342
|
+
return event_base_loop (base, 0);
|
343
|
+
}
|
344
|
+
|
345
|
+
static void
|
346
|
+
ev_x_loopexit_cb (int revents, void *base)
|
347
|
+
{
|
348
|
+
dLOOPbase;
|
349
|
+
|
350
|
+
ev_break (EV_A_ EVBREAK_ONE);
|
351
|
+
}
|
352
|
+
|
353
|
+
int event_base_loopexit (struct event_base *base, struct timeval *tv)
|
354
|
+
{
|
355
|
+
ev_tstamp after = ev_tv_get (tv);
|
356
|
+
dLOOPbase;
|
357
|
+
|
358
|
+
ev_once (EV_A_ -1, 0, after >= 0. ? after : 0., ev_x_loopexit_cb, (void *)base);
|
359
|
+
|
360
|
+
return 0;
|
361
|
+
}
|
362
|
+
|
363
|
+
struct ev_x_once
|
364
|
+
{
|
365
|
+
int fd;
|
366
|
+
void (*cb)(int, short, void *);
|
367
|
+
void *arg;
|
368
|
+
};
|
369
|
+
|
370
|
+
static void
|
371
|
+
ev_x_once_cb (int revents, void *arg)
|
372
|
+
{
|
373
|
+
struct ev_x_once *once = (struct ev_x_once *)arg;
|
374
|
+
|
375
|
+
once->cb (once->fd, (short)revents, once->arg);
|
376
|
+
free (once);
|
377
|
+
}
|
378
|
+
|
379
|
+
int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv)
|
380
|
+
{
|
381
|
+
struct ev_x_once *once = (struct ev_x_once *)malloc (sizeof (struct ev_x_once));
|
382
|
+
dLOOPbase;
|
383
|
+
|
384
|
+
if (!once)
|
385
|
+
return -1;
|
386
|
+
|
387
|
+
once->fd = fd;
|
388
|
+
once->cb = cb;
|
389
|
+
once->arg = arg;
|
390
|
+
|
391
|
+
ev_once (EV_A_ fd, events & (EV_READ | EV_WRITE), ev_tv_get (tv), ev_x_once_cb, (void *)once);
|
392
|
+
|
393
|
+
return 0;
|
394
|
+
}
|
395
|
+
|
396
|
+
int event_base_priority_init (struct event_base *base, int npri)
|
397
|
+
{
|
398
|
+
/*dLOOPbase;*/
|
399
|
+
|
400
|
+
return 0;
|
401
|
+
}
|
402
|
+
|
@@ -0,0 +1,170 @@
|
|
1
|
+
/*
|
2
|
+
* libevent compatibility header, only core events supported
|
3
|
+
*
|
4
|
+
* Copyright (c) 2007,2008,2010 Marc Alexander Lehmann <libev@schmorp.de>
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without modifica-
|
8
|
+
* tion, are permitted provided that the following conditions are met:
|
9
|
+
*
|
10
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
11
|
+
* this list of conditions and the following disclaimer.
|
12
|
+
*
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in the
|
15
|
+
* documentation and/or other materials provided with the distribution.
|
16
|
+
*
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
18
|
+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
19
|
+
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
20
|
+
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
|
21
|
+
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
23
|
+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
24
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
|
25
|
+
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
26
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
*
|
28
|
+
* Alternatively, the contents of this file may be used under the terms of
|
29
|
+
* the GNU General Public License ("GPL") version 2 or any later version,
|
30
|
+
* in which case the provisions of the GPL are applicable instead of
|
31
|
+
* the above. If you wish to allow the use of your version of this file
|
32
|
+
* only under the terms of the GPL and not to allow others to use your
|
33
|
+
* version of this file under the BSD license, indicate your decision
|
34
|
+
* by deleting the provisions above and replace them with the notice
|
35
|
+
* and other provisions required by the GPL. If you do not delete the
|
36
|
+
* provisions above, a recipient may use your version of this file under
|
37
|
+
* either the BSD or the GPL.
|
38
|
+
*/
|
39
|
+
|
40
|
+
#ifndef EVENT_H_
|
41
|
+
#define EVENT_H_
|
42
|
+
|
43
|
+
#ifdef EV_H
|
44
|
+
# include EV_H
|
45
|
+
#else
|
46
|
+
# include "ev.h"
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#ifndef EVLOOP_NONBLOCK
|
50
|
+
# define EVLOOP_NONBLOCK EVRUN_NOWAIT
|
51
|
+
#endif
|
52
|
+
#ifndef EVLOOP_ONESHOT
|
53
|
+
# define EVLOOP_ONESHOT EVRUN_ONCE
|
54
|
+
#endif
|
55
|
+
#ifndef EV_TIMEOUT
|
56
|
+
# define EV_TIMEOUT EV_TIMER
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#ifdef __cplusplus
|
60
|
+
extern "C" {
|
61
|
+
#endif
|
62
|
+
|
63
|
+
/* we need sys/time.h for struct timeval only */
|
64
|
+
#if !defined (WIN32) || defined (__MINGW32__)
|
65
|
+
# include <time.h> /* mingw seems to need this, for whatever reason */
|
66
|
+
# include <sys/time.h>
|
67
|
+
#endif
|
68
|
+
|
69
|
+
struct event_base;
|
70
|
+
|
71
|
+
#define EVLIST_TIMEOUT 0x01
|
72
|
+
#define EVLIST_INSERTED 0x02
|
73
|
+
#define EVLIST_SIGNAL 0x04
|
74
|
+
#define EVLIST_ACTIVE 0x08
|
75
|
+
#define EVLIST_INTERNAL 0x10
|
76
|
+
#define EVLIST_INIT 0x80
|
77
|
+
|
78
|
+
struct event
|
79
|
+
{
|
80
|
+
/* libev watchers we map onto */
|
81
|
+
union {
|
82
|
+
struct ev_io io;
|
83
|
+
struct ev_signal sig;
|
84
|
+
} iosig;
|
85
|
+
struct ev_timer to;
|
86
|
+
|
87
|
+
/* compatibility slots */
|
88
|
+
struct event_base *ev_base;
|
89
|
+
void (*ev_callback)(int, short, void *arg);
|
90
|
+
void *ev_arg;
|
91
|
+
int ev_fd;
|
92
|
+
int ev_pri;
|
93
|
+
int ev_res;
|
94
|
+
int ev_flags;
|
95
|
+
short ev_events;
|
96
|
+
};
|
97
|
+
|
98
|
+
#define EV_READ EV_READ
|
99
|
+
#define EV_WRITE EV_WRITE
|
100
|
+
#define EV_PERSIST 0x10
|
101
|
+
|
102
|
+
#define EVENT_SIGNAL(ev) ((int) (ev)->ev_fd)
|
103
|
+
#define EVENT_FD(ev) ((int) (ev)->ev_fd)
|
104
|
+
|
105
|
+
#define event_initialized(ev) ((ev)->ev_flags & EVLIST_INIT)
|
106
|
+
|
107
|
+
#define evtimer_add(ev,tv) event_add (ev, tv)
|
108
|
+
#define evtimer_set(ev,cb,data) event_set (ev, -1, 0, cb, data)
|
109
|
+
#define evtimer_del(ev) event_del (ev)
|
110
|
+
#define evtimer_pending(ev,tv) event_pending (ev, EV_TIMEOUT, tv)
|
111
|
+
#define evtimer_initialized(ev) event_initialized (ev)
|
112
|
+
|
113
|
+
#define timeout_add(ev,tv) evtimer_add (ev, tv)
|
114
|
+
#define timeout_set(ev,cb,data) evtimer_set (ev, cb, data)
|
115
|
+
#define timeout_del(ev) evtimer_del (ev)
|
116
|
+
#define timeout_pending(ev,tv) evtimer_pending (ev, tv)
|
117
|
+
#define timeout_initialized(ev) evtimer_initialized (ev)
|
118
|
+
|
119
|
+
#define signal_add(ev,tv) event_add (ev, tv)
|
120
|
+
#define signal_set(ev,sig,cb,data) event_set (ev, sig, EV_SIGNAL | EV_PERSIST, cb, data)
|
121
|
+
#define signal_del(ev) event_del (ev)
|
122
|
+
#define signal_pending(ev,tv) event_pending (ev, EV_SIGNAL, tv)
|
123
|
+
#define signal_initialized(ev) event_initialized (ev)
|
124
|
+
|
125
|
+
const char *event_get_version (void);
|
126
|
+
const char *event_get_method (void);
|
127
|
+
|
128
|
+
void *event_init (void);
|
129
|
+
void event_base_free (struct event_base *base);
|
130
|
+
|
131
|
+
#define EVLOOP_ONCE EVLOOP_ONESHOT
|
132
|
+
int event_loop (int);
|
133
|
+
int event_loopexit (struct timeval *tv);
|
134
|
+
int event_dispatch (void);
|
135
|
+
|
136
|
+
#define _EVENT_LOG_DEBUG 0
|
137
|
+
#define _EVENT_LOG_MSG 1
|
138
|
+
#define _EVENT_LOG_WARN 2
|
139
|
+
#define _EVENT_LOG_ERR 3
|
140
|
+
typedef void (*event_log_cb)(int severity, const char *msg);
|
141
|
+
void event_set_log_callback(event_log_cb cb);
|
142
|
+
|
143
|
+
void event_set (struct event *ev, int fd, short events, void (*cb)(int, short, void *), void *arg);
|
144
|
+
int event_once (int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv);
|
145
|
+
|
146
|
+
int event_add (struct event *ev, struct timeval *tv);
|
147
|
+
int event_del (struct event *ev);
|
148
|
+
void event_active (struct event *ev, int res, short ncalls); /* ncalls is being ignored */
|
149
|
+
|
150
|
+
int event_pending (struct event *ev, short, struct timeval *tv);
|
151
|
+
|
152
|
+
int event_priority_init (int npri);
|
153
|
+
int event_priority_set (struct event *ev, int pri);
|
154
|
+
|
155
|
+
int event_base_set (struct event_base *base, struct event *ev);
|
156
|
+
int event_base_loop (struct event_base *base, int);
|
157
|
+
int event_base_loopexit (struct event_base *base, struct timeval *tv);
|
158
|
+
int event_base_dispatch (struct event_base *base);
|
159
|
+
int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv);
|
160
|
+
int event_base_priority_init (struct event_base *base, int fd);
|
161
|
+
|
162
|
+
/* next line is different in the libevent+libev version */
|
163
|
+
/*libevent-include*/
|
164
|
+
|
165
|
+
#ifdef __cplusplus
|
166
|
+
}
|
167
|
+
#endif
|
168
|
+
|
169
|
+
#endif
|
170
|
+
|