asyncengine 0.0.1.testing → 0.0.1.testing1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (400) hide show
  1. data/asyncengine.gemspec +3 -3
  2. data/ext/asyncengine/ae_handle_common.c +100 -0
  3. data/ext/asyncengine/ae_handle_common.h +20 -0
  4. data/ext/asyncengine/ae_next_tick.c +51 -0
  5. data/ext/asyncengine/ae_next_tick.h +10 -0
  6. data/ext/asyncengine/ae_timer.c +152 -0
  7. data/ext/asyncengine/ae_timer.h +12 -0
  8. data/ext/asyncengine/ae_udp.c +24 -0
  9. data/ext/asyncengine/ae_udp.h +10 -0
  10. data/ext/asyncengine/asyncengine_ruby.c +72 -0
  11. data/ext/asyncengine/asyncengine_ruby.h +22 -0
  12. data/ext/{asyncengine_ext → asyncengine}/extconf.rb +7 -7
  13. data/ext/{asyncengine_ext → asyncengine}/libuv/AUTHORS +0 -0
  14. data/ext/{asyncengine_ext → asyncengine}/libuv/LICENSE +0 -0
  15. data/ext/{asyncengine_ext → asyncengine}/libuv/Makefile +0 -0
  16. data/ext/{asyncengine_ext → asyncengine}/libuv/README.md +0 -0
  17. data/ext/{asyncengine_ext → asyncengine}/libuv/build/gcc_version.py +0 -0
  18. data/ext/{asyncengine_ext → asyncengine}/libuv/common.gypi +0 -0
  19. data/ext/{asyncengine_ext → asyncengine}/libuv/config-mingw.mk +0 -0
  20. data/ext/{asyncengine_ext → asyncengine}/libuv/config-unix.mk +0 -0
  21. data/ext/{asyncengine_ext → asyncengine}/libuv/gyp_uv +0 -0
  22. data/ext/{asyncengine_ext → asyncengine}/libuv/include/ares.h +0 -0
  23. data/ext/{asyncengine_ext → asyncengine}/libuv/include/ares_version.h +0 -0
  24. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv-private/eio.h +0 -0
  25. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv-private/ev.h +0 -0
  26. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv-private/ngx-queue.h +0 -0
  27. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv-private/tree.h +0 -0
  28. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv-private/uv-unix.h +0 -0
  29. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv-private/uv-win.h +0 -0
  30. data/ext/{asyncengine_ext → asyncengine}/libuv/include/uv.h +0 -0
  31. data/ext/asyncengine/libuv/mkmf.log +24 -0
  32. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/AUTHORS +0 -0
  33. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/CHANGES +0 -0
  34. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/CMakeLists.txt +0 -0
  35. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/NEWS +0 -0
  36. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/README +0 -0
  37. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/README.cares +0 -0
  38. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/README.msvc +0 -0
  39. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/README.node +0 -0
  40. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/RELEASE-NOTES +0 -0
  41. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/TODO +0 -0
  42. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares__close_sockets.c +0 -0
  43. data/ext/asyncengine/libuv/src/ares/ares__close_sockets.o +0 -0
  44. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares__get_hostent.c +0 -0
  45. data/ext/asyncengine/libuv/src/ares/ares__get_hostent.o +0 -0
  46. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares__read_line.c +0 -0
  47. data/ext/asyncengine/libuv/src/ares/ares__read_line.o +0 -0
  48. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares__timeval.c +0 -0
  49. data/ext/asyncengine/libuv/src/ares/ares__timeval.o +0 -0
  50. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_cancel.c +0 -0
  51. data/ext/asyncengine/libuv/src/ares/ares_cancel.o +0 -0
  52. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_data.c +0 -0
  53. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_data.h +0 -0
  54. data/ext/asyncengine/libuv/src/ares/ares_data.o +0 -0
  55. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_destroy.c +0 -0
  56. data/ext/asyncengine/libuv/src/ares/ares_destroy.o +0 -0
  57. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_dns.h +0 -0
  58. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_expand_name.c +0 -0
  59. data/ext/asyncengine/libuv/src/ares/ares_expand_name.o +0 -0
  60. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_expand_string.c +0 -0
  61. data/ext/asyncengine/libuv/src/ares/ares_expand_string.o +0 -0
  62. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_fds.c +0 -0
  63. data/ext/asyncengine/libuv/src/ares/ares_fds.o +0 -0
  64. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_free_hostent.c +0 -0
  65. data/ext/asyncengine/libuv/src/ares/ares_free_hostent.o +0 -0
  66. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_free_string.c +0 -0
  67. data/ext/asyncengine/libuv/src/ares/ares_free_string.o +0 -0
  68. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_getenv.c +0 -0
  69. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_getenv.h +0 -0
  70. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_gethostbyaddr.c +0 -0
  71. data/ext/asyncengine/libuv/src/ares/ares_gethostbyaddr.o +0 -0
  72. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_gethostbyname.c +0 -0
  73. data/ext/asyncengine/libuv/src/ares/ares_gethostbyname.o +0 -0
  74. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_getnameinfo.c +0 -0
  75. data/ext/asyncengine/libuv/src/ares/ares_getnameinfo.o +0 -0
  76. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_getopt.c +0 -0
  77. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_getopt.h +0 -0
  78. data/ext/asyncengine/libuv/src/ares/ares_getopt.o +0 -0
  79. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_getsock.c +0 -0
  80. data/ext/asyncengine/libuv/src/ares/ares_getsock.o +0 -0
  81. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_init.c +0 -0
  82. data/ext/asyncengine/libuv/src/ares/ares_init.o +0 -0
  83. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_iphlpapi.h +0 -0
  84. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_ipv6.h +0 -0
  85. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_library_init.c +0 -0
  86. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_library_init.h +0 -0
  87. data/ext/asyncengine/libuv/src/ares/ares_library_init.o +0 -0
  88. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_llist.c +0 -0
  89. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_llist.h +0 -0
  90. data/ext/asyncengine/libuv/src/ares/ares_llist.o +0 -0
  91. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_mkquery.c +0 -0
  92. data/ext/asyncengine/libuv/src/ares/ares_mkquery.o +0 -0
  93. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_nowarn.c +0 -0
  94. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_nowarn.h +0 -0
  95. data/ext/asyncengine/libuv/src/ares/ares_nowarn.o +0 -0
  96. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_options.c +0 -0
  97. data/ext/asyncengine/libuv/src/ares/ares_options.o +0 -0
  98. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_a_reply.c +0 -0
  99. data/ext/asyncengine/libuv/src/ares/ares_parse_a_reply.o +0 -0
  100. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_aaaa_reply.c +0 -0
  101. data/ext/asyncengine/libuv/src/ares/ares_parse_aaaa_reply.o +0 -0
  102. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_mx_reply.c +0 -0
  103. data/ext/asyncengine/libuv/src/ares/ares_parse_mx_reply.o +0 -0
  104. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_ns_reply.c +0 -0
  105. data/ext/asyncengine/libuv/src/ares/ares_parse_ns_reply.o +0 -0
  106. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_ptr_reply.c +0 -0
  107. data/ext/asyncengine/libuv/src/ares/ares_parse_ptr_reply.o +0 -0
  108. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_srv_reply.c +0 -0
  109. data/ext/asyncengine/libuv/src/ares/ares_parse_srv_reply.o +0 -0
  110. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_parse_txt_reply.c +0 -0
  111. data/ext/asyncengine/libuv/src/ares/ares_parse_txt_reply.o +0 -0
  112. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_platform.c +0 -0
  113. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_platform.h +0 -0
  114. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_private.h +0 -0
  115. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_process.c +0 -0
  116. data/ext/asyncengine/libuv/src/ares/ares_process.o +0 -0
  117. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_query.c +0 -0
  118. data/ext/asyncengine/libuv/src/ares/ares_query.o +0 -0
  119. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_rules.h +0 -0
  120. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_search.c +0 -0
  121. data/ext/asyncengine/libuv/src/ares/ares_search.o +0 -0
  122. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_send.c +0 -0
  123. data/ext/asyncengine/libuv/src/ares/ares_send.o +0 -0
  124. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_setup.h +0 -0
  125. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_strcasecmp.c +0 -0
  126. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_strcasecmp.h +0 -0
  127. data/ext/asyncengine/libuv/src/ares/ares_strcasecmp.o +0 -0
  128. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_strdup.c +0 -0
  129. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_strdup.h +0 -0
  130. data/ext/asyncengine/libuv/src/ares/ares_strdup.o +0 -0
  131. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_strerror.c +0 -0
  132. data/ext/asyncengine/libuv/src/ares/ares_strerror.o +0 -0
  133. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_timeout.c +0 -0
  134. data/ext/asyncengine/libuv/src/ares/ares_timeout.o +0 -0
  135. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_version.c +0 -0
  136. data/ext/asyncengine/libuv/src/ares/ares_version.o +0 -0
  137. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_writev.c +0 -0
  138. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/ares_writev.h +0 -0
  139. data/ext/asyncengine/libuv/src/ares/ares_writev.o +0 -0
  140. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/bitncmp.c +0 -0
  141. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/bitncmp.h +0 -0
  142. data/ext/asyncengine/libuv/src/ares/bitncmp.o +0 -0
  143. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_cygwin/ares_config.h +0 -0
  144. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_darwin/ares_config.h +0 -0
  145. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_freebsd/ares_config.h +0 -0
  146. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_linux/ares_config.h +0 -0
  147. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_netbsd/ares_config.h +0 -0
  148. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_openbsd/ares_config.h +0 -0
  149. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_sunos/ares_config.h +0 -0
  150. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/config_win32/ares_config.h +0 -0
  151. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/get_ver.awk +0 -0
  152. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/inet_net_pton.c +0 -0
  153. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/inet_net_pton.h +0 -0
  154. data/ext/asyncengine/libuv/src/ares/inet_net_pton.o +0 -0
  155. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/inet_ntop.c +0 -0
  156. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/inet_ntop.h +0 -0
  157. data/ext/asyncengine/libuv/src/ares/inet_ntop.o +0 -0
  158. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/nameser.h +0 -0
  159. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/setup_once.h +0 -0
  160. data/ext/{asyncengine_ext → asyncengine}/libuv/src/ares/windows_port.c +0 -0
  161. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/async.c +0 -0
  162. data/ext/asyncengine/libuv/src/unix/async.o +0 -0
  163. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/cares.c +0 -0
  164. data/ext/asyncengine/libuv/src/unix/cares.o +0 -0
  165. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/check.c +0 -0
  166. data/ext/asyncengine/libuv/src/unix/check.o +0 -0
  167. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/core.c +0 -0
  168. data/ext/asyncengine/libuv/src/unix/core.o +0 -0
  169. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/cygwin.c +0 -0
  170. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/darwin.c +0 -0
  171. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/dl.c +0 -0
  172. data/ext/asyncengine/libuv/src/unix/dl.o +0 -0
  173. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/Changes +0 -0
  174. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/LICENSE +0 -0
  175. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/Makefile.am +0 -0
  176. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/aclocal.m4 +0 -0
  177. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/autogen.sh +0 -0
  178. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config.h.in +0 -0
  179. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_cygwin.h +0 -0
  180. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_darwin.h +0 -0
  181. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_freebsd.h +0 -0
  182. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_linux.h +0 -0
  183. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_netbsd.h +0 -0
  184. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_openbsd.h +0 -0
  185. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/config_sunos.h +0 -0
  186. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/configure.ac +0 -0
  187. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/demo.c +0 -0
  188. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/ecb.h +0 -0
  189. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/eio.3 +0 -0
  190. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/eio.c +0 -0
  191. data/ext/asyncengine/libuv/src/unix/eio/eio.o +0 -0
  192. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/eio.pod +0 -0
  193. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/libeio.m4 +0 -0
  194. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/eio/xthread.h +0 -0
  195. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/error.c +0 -0
  196. data/ext/asyncengine/libuv/src/unix/error.o +0 -0
  197. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/Changes +0 -0
  198. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/LICENSE +0 -0
  199. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/Makefile.am +0 -0
  200. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/Makefile.in +0 -0
  201. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/README +0 -0
  202. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/aclocal.m4 +0 -0
  203. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/autogen.sh +0 -0
  204. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config.guess +0 -0
  205. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config.h.in +0 -0
  206. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config.sub +0 -0
  207. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_cygwin.h +0 -0
  208. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_darwin.h +0 -0
  209. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_freebsd.h +0 -0
  210. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_linux.h +0 -0
  211. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_netbsd.h +0 -0
  212. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_openbsd.h +0 -0
  213. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/config_sunos.h +0 -0
  214. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/configure +0 -0
  215. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/configure.ac +0 -0
  216. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/depcomp +0 -0
  217. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev++.h +0 -0
  218. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev.3 +0 -0
  219. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev.c +0 -0
  220. data/ext/asyncengine/libuv/src/unix/ev/ev.o +0 -0
  221. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev.pod +0 -0
  222. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_epoll.c +0 -0
  223. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_kqueue.c +0 -0
  224. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_poll.c +0 -0
  225. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_port.c +0 -0
  226. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_select.c +0 -0
  227. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_vars.h +0 -0
  228. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_win32.c +0 -0
  229. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ev_wrap.h +0 -0
  230. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/event.c +0 -0
  231. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/event.h +0 -0
  232. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/install-sh +0 -0
  233. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/libev.m4 +0 -0
  234. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/ltmain.sh +0 -0
  235. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/missing +0 -0
  236. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/ev/mkinstalldirs +0 -0
  237. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/freebsd.c +0 -0
  238. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/fs.c +0 -0
  239. data/ext/asyncengine/libuv/src/unix/fs.o +0 -0
  240. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/idle.c +0 -0
  241. data/ext/asyncengine/libuv/src/unix/idle.o +0 -0
  242. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/internal.h +0 -0
  243. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/kqueue.c +0 -0
  244. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/linux/core.c +0 -0
  245. data/ext/asyncengine/libuv/src/unix/linux/core.o +0 -0
  246. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/linux/inotify.c +0 -0
  247. data/ext/asyncengine/libuv/src/unix/linux/inotify.o +0 -0
  248. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/linux/syscalls.c +0 -0
  249. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/linux/syscalls.h +0 -0
  250. data/ext/asyncengine/libuv/src/unix/linux/syscalls.o +0 -0
  251. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/loop.c +0 -0
  252. data/ext/asyncengine/libuv/src/unix/loop.o +0 -0
  253. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/netbsd.c +0 -0
  254. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/openbsd.c +0 -0
  255. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/pipe.c +0 -0
  256. data/ext/asyncengine/libuv/src/unix/pipe.o +0 -0
  257. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/prepare.c +0 -0
  258. data/ext/asyncengine/libuv/src/unix/prepare.o +0 -0
  259. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/process.c +0 -0
  260. data/ext/asyncengine/libuv/src/unix/process.o +0 -0
  261. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/stream.c +0 -0
  262. data/ext/asyncengine/libuv/src/unix/stream.o +0 -0
  263. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/sunos.c +0 -0
  264. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/tcp.c +0 -0
  265. data/ext/asyncengine/libuv/src/unix/tcp.o +0 -0
  266. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/thread.c +0 -0
  267. data/ext/asyncengine/libuv/src/unix/thread.o +0 -0
  268. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/timer.c +0 -0
  269. data/ext/asyncengine/libuv/src/unix/timer.o +0 -0
  270. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/tty.c +0 -0
  271. data/ext/asyncengine/libuv/src/unix/tty.o +0 -0
  272. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/udp.c +0 -0
  273. data/ext/asyncengine/libuv/src/unix/udp.o +0 -0
  274. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/uv-eio.c +0 -0
  275. data/ext/{asyncengine_ext → asyncengine}/libuv/src/unix/uv-eio.h +0 -0
  276. data/ext/asyncengine/libuv/src/unix/uv-eio.o +0 -0
  277. data/ext/{asyncengine_ext → asyncengine}/libuv/src/uv-common.c +0 -0
  278. data/ext/{asyncengine_ext → asyncengine}/libuv/src/uv-common.h +0 -0
  279. data/ext/asyncengine/libuv/src/uv-common.o +0 -0
  280. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/async.c +0 -0
  281. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/cares.c +0 -0
  282. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/core.c +0 -0
  283. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/dl.c +0 -0
  284. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/error.c +0 -0
  285. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/fs-event.c +0 -0
  286. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/fs.c +0 -0
  287. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/getaddrinfo.c +0 -0
  288. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/handle.c +0 -0
  289. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/internal.h +0 -0
  290. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/loop-watcher.c +0 -0
  291. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/pipe.c +0 -0
  292. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/process.c +0 -0
  293. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/req.c +0 -0
  294. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/stream.c +0 -0
  295. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/tcp.c +0 -0
  296. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/thread.c +0 -0
  297. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/threadpool.c +0 -0
  298. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/timer.c +0 -0
  299. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/tty.c +0 -0
  300. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/udp.c +0 -0
  301. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/util.c +0 -0
  302. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/winapi.c +0 -0
  303. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/winapi.h +0 -0
  304. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/winsock.c +0 -0
  305. data/ext/{asyncengine_ext → asyncengine}/libuv/src/win/winsock.h +0 -0
  306. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-ares.c +0 -0
  307. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-getaddrinfo.c +0 -0
  308. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-list.h +0 -0
  309. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-ping-pongs.c +0 -0
  310. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-pound.c +0 -0
  311. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-pump.c +0 -0
  312. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-sizes.c +0 -0
  313. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-spawn.c +0 -0
  314. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-tcp-write-batch.c +0 -0
  315. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-thread.c +0 -0
  316. data/ext/{asyncengine_ext → asyncengine}/libuv/test/benchmark-udp-packet-storm.c +0 -0
  317. data/ext/{asyncengine_ext → asyncengine}/libuv/test/blackhole-server.c +0 -0
  318. data/ext/{asyncengine_ext → asyncengine}/libuv/test/dns-server.c +0 -0
  319. data/ext/{asyncengine_ext → asyncengine}/libuv/test/echo-server.c +0 -0
  320. data/ext/{asyncengine_ext → asyncengine}/libuv/test/fixtures/empty_file +0 -0
  321. data/ext/{asyncengine_ext → asyncengine}/libuv/test/fixtures/load_error.node +0 -0
  322. data/ext/{asyncengine_ext → asyncengine}/libuv/test/run-benchmarks.c +0 -0
  323. data/ext/{asyncengine_ext → asyncengine}/libuv/test/run-tests.c +0 -0
  324. data/ext/{asyncengine_ext → asyncengine}/libuv/test/runner-unix.c +0 -0
  325. data/ext/{asyncengine_ext → asyncengine}/libuv/test/runner-unix.h +0 -0
  326. data/ext/{asyncengine_ext → asyncengine}/libuv/test/runner-win.c +0 -0
  327. data/ext/{asyncengine_ext → asyncengine}/libuv/test/runner-win.h +0 -0
  328. data/ext/{asyncengine_ext → asyncengine}/libuv/test/runner.c +0 -0
  329. data/ext/{asyncengine_ext → asyncengine}/libuv/test/runner.h +0 -0
  330. data/ext/{asyncengine_ext → asyncengine}/libuv/test/task.h +0 -0
  331. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-async.c +0 -0
  332. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-callback-stack.c +0 -0
  333. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-connection-fail.c +0 -0
  334. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-counters-init.c +0 -0
  335. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-cwd-and-chdir.c +0 -0
  336. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-delayed-accept.c +0 -0
  337. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-dlerror.c +0 -0
  338. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-eio-overflow.c +0 -0
  339. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-error.c +0 -0
  340. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-fail-always.c +0 -0
  341. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-fs-event.c +0 -0
  342. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-fs.c +0 -0
  343. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-get-currentexe.c +0 -0
  344. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-get-loadavg.c +0 -0
  345. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-get-memory.c +0 -0
  346. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-getaddrinfo.c +0 -0
  347. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-gethostbyname.c +0 -0
  348. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-getsockname.c +0 -0
  349. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-hrtime.c +0 -0
  350. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-idle.c +0 -0
  351. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-ipc-send-recv.c +0 -0
  352. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-ipc.c +0 -0
  353. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-list.h +0 -0
  354. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-loop-handles.c +0 -0
  355. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-multiple-listen.c +0 -0
  356. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-mutexes.c +0 -0
  357. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-pass-always.c +0 -0
  358. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-ping-pong.c +0 -0
  359. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-pipe-bind-error.c +0 -0
  360. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-pipe-connect-error.c +0 -0
  361. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-platform-output.c +0 -0
  362. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-process-title.c +0 -0
  363. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-ref.c +0 -0
  364. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-run-once.c +0 -0
  365. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-shutdown-close.c +0 -0
  366. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-shutdown-eof.c +0 -0
  367. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-spawn.c +0 -0
  368. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-stdio-over-pipes.c +0 -0
  369. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-bind-error.c +0 -0
  370. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-bind6-error.c +0 -0
  371. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-close.c +0 -0
  372. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-connect-error.c +0 -0
  373. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-connect6-error.c +0 -0
  374. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-flags.c +0 -0
  375. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-write-error.c +0 -0
  376. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-write-to-half-open-connection.c +0 -0
  377. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tcp-writealot.c +0 -0
  378. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-thread.c +0 -0
  379. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-threadpool.c +0 -0
  380. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-timer-again.c +0 -0
  381. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-timer.c +0 -0
  382. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-tty.c +0 -0
  383. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-udp-dgram-too-big.c +0 -0
  384. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-udp-ipv6.c +0 -0
  385. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-udp-multicast-join.c +0 -0
  386. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-udp-multicast-ttl.c +0 -0
  387. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-udp-options.c +0 -0
  388. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-udp-send-and-recv.c +0 -0
  389. data/ext/{asyncengine_ext → asyncengine}/libuv/test/test-util.c +0 -0
  390. data/ext/{asyncengine_ext → asyncengine}/libuv/uv.gyp +0 -0
  391. data/ext/{asyncengine_ext → asyncengine}/libuv/vcbuild.bat +0 -0
  392. data/lib/asyncengine/asyncengine_ext.so +0 -0
  393. data/lib/asyncengine/errors.rb +5 -0
  394. data/lib/asyncengine/next_tick.rb +24 -0
  395. data/lib/asyncengine/timer.rb +46 -0
  396. data/lib/asyncengine/udp.rb +5 -0
  397. data/lib/asyncengine/version.rb +1 -1
  398. data/lib/asyncengine.rb +50 -26
  399. metadata +399 -316
  400. data/ext/asyncengine_ext/asyncengine_ruby.c +0 -82
data/asyncengine.gemspec CHANGED
@@ -11,15 +11,15 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Ruby asynchronous event driven library based on libuv"
12
12
  spec.homepage = "https://github.com/ibc/AsyncEngine"
13
13
  spec.description = "Ruby asynchronous event driven library based on libuv"
14
- spec.extensions = ["ext/asyncengine_ext/extconf.rb"]
14
+ spec.extensions = ["ext/asyncengine/extconf.rb"]
15
15
  spec.required_ruby_version = ">= 1.9.2"
16
16
 
17
17
  files = %w{
18
18
  asyncengine.gemspec
19
19
  README.markdown
20
20
  lib/**/**
21
- ext/asyncengine_ext/{*.c,*.h,*.rb}
22
- ext/asyncengine_ext/libuv/**/**/**/**/**/**/**/**/**
21
+ ext/asyncengine/{*.c,*.h,*.rb}
22
+ ext/asyncengine/libuv/**/**/**/**/**/**/**/**/**
23
23
  }.join(",")
24
24
  spec.files = Dir.glob "{#{files}}"
25
25
  spec.require_paths = ["lib"]
@@ -0,0 +1,100 @@
1
+ #include "asyncengine_ruby.h"
2
+ #include "ae_handle_common.h"
3
+
4
+
5
+ // Global variables defined in asyncengine_ruby.c.
6
+ extern VALUE mAsyncEngine;
7
+
8
+ // C variable holding current block number.
9
+ static long block_id = 0;
10
+
11
+ // Ruby class for saving C data inside.
12
+ VALUE cAsyncEngineCData;
13
+
14
+ // Ruby attributes.
15
+ static ID att_blocks;
16
+ ID att_cdata;
17
+ ID att_handle_terminated;
18
+
19
+ // Ruby method names.
20
+ ID id_method_call;
21
+ ID id_manage_exception;
22
+
23
+
24
+ void init_ae_handle_common()
25
+ {
26
+ cAsyncEngineCData = rb_define_class_under(mAsyncEngine, "CData", rb_cObject);
27
+
28
+ att_blocks = rb_intern("@_blocks");
29
+ att_cdata = rb_intern("@_cdata");
30
+ att_handle_terminated = rb_intern("@_handle_terminated");
31
+
32
+ id_method_call = rb_intern("call");
33
+ id_manage_exception = rb_intern("manage_exception");
34
+ }
35
+
36
+
37
+ VALUE ae_store_block(VALUE block)
38
+ {
39
+ AE_TRACE();
40
+ VALUE rb_block_id = LONG2FIX(++block_id);
41
+
42
+ rb_hash_aset(rb_ivar_get(mAsyncEngine, att_blocks), rb_block_id, block);
43
+ return rb_block_id;
44
+ }
45
+
46
+
47
+ VALUE ae_get_block(VALUE rb_block_id)
48
+ {
49
+ AE_TRACE();
50
+ return rb_hash_aref(rb_ivar_get(mAsyncEngine, att_blocks), rb_block_id);
51
+ }
52
+
53
+
54
+ VALUE ae_remove_block(VALUE rb_block_id)
55
+ {
56
+ AE_TRACE();
57
+ return rb_hash_delete(rb_ivar_get(mAsyncEngine, att_blocks), rb_block_id);
58
+ }
59
+
60
+
61
+ void ae_manage_exception(int exception_tag)
62
+ {
63
+ AE_TRACE();
64
+
65
+ // rb_errinfo() gives the current exception object in this thread.
66
+ VALUE exception = rb_errinfo();
67
+
68
+ // Just check the exception in the user provided AE.exception_manager block if
69
+ // it is a StandardError. Otherwise raise it and terminate.
70
+ if (rb_obj_is_kind_of(exception, rb_eStandardError) == Qtrue) {
71
+ rb_funcall(mAsyncEngine, id_manage_exception, 1, exception);
72
+ // Dissable the current thread exception.
73
+ rb_set_errinfo(Qnil);
74
+ }
75
+ else
76
+ rb_jump_tag(exception_tag);
77
+ }
78
+
79
+
80
+ void ae_handle_close_callback_0(uv_handle_t* handle)
81
+ {
82
+ AE_TRACE();
83
+ xfree(handle);
84
+ }
85
+
86
+
87
+ static VALUE wrapper_rb_funcall_0(VALUE block)
88
+ {
89
+ rb_funcall(block, id_method_call, 0, 0);
90
+ return Qnil;
91
+ }
92
+
93
+
94
+ int ae_protect_block_call_0(VALUE block)
95
+ {
96
+ int exception = 0;
97
+
98
+ rb_protect(wrapper_rb_funcall_0, block, &exception);
99
+ return exception;
100
+ }
@@ -0,0 +1,20 @@
1
+ #ifndef AE_HANDLE_COMMON_H
2
+ #define AE_HANDLE_COMMON_H
3
+
4
+
5
+ VALUE cAsyncEngineCData;
6
+ ID att_cdata;
7
+ ID att_handle_terminated;
8
+ ID id_method_call;
9
+
10
+ void init_ae_handle_common();
11
+
12
+ VALUE ae_store_block(VALUE);
13
+ VALUE ae_get_block(VALUE);
14
+ VALUE ae_remove_block(VALUE);
15
+ void ae_manage_exception(int);
16
+ void ae_handle_close_callback_0(uv_handle_t*);
17
+ int ae_protect_block_call_0(VALUE);
18
+
19
+
20
+ #endif /* AE_HANDLE_COMMON_H */
@@ -0,0 +1,51 @@
1
+ #include "asyncengine_ruby.h"
2
+ #include "ae_handle_common.h"
3
+ #include "ae_next_tick.h"
4
+
5
+
6
+ // C variable indicating whether there are pending next_ticks.
7
+ static int pending_next_ticks;
8
+
9
+ static ID id_method_execute_next_ticks;
10
+
11
+
12
+ void init_ae_next_tick()
13
+ {
14
+ pending_next_ticks = 0;
15
+
16
+ rb_define_module_function(mAsyncEngine, "_c_next_tick", AsyncEngine_c_next_tick, 0);
17
+
18
+ id_method_execute_next_ticks = rb_intern("execute_next_ticks");
19
+ }
20
+
21
+
22
+ static
23
+ void execute_next_tick_with_gvl()
24
+ {
25
+ AE_TRACE();
26
+ rb_funcall(mAsyncEngine, id_method_execute_next_ticks, 0, 0);
27
+ }
28
+
29
+
30
+ static
31
+ void next_tick_callback(uv_idle_t* handle, int status)
32
+ {
33
+ AE_TRACE();
34
+ uv_idle_stop(handle);
35
+ uv_close((uv_handle_t *)handle, ae_handle_close_callback_0);
36
+ pending_next_ticks = 0;
37
+ rb_thread_call_with_gvl(execute_next_tick_with_gvl, NULL);
38
+ }
39
+
40
+
41
+ VALUE AsyncEngine_c_next_tick(VALUE self)
42
+ {
43
+ AE_TRACE();
44
+ if (pending_next_ticks == 0) {
45
+ uv_idle_t* _uv_handle = ALLOC(uv_idle_t);
46
+ uv_idle_init(uv_default_loop(), _uv_handle);
47
+ pending_next_ticks = 1;
48
+ uv_idle_start(_uv_handle, next_tick_callback);
49
+ }
50
+ return Qtrue;
51
+ }
@@ -0,0 +1,10 @@
1
+ #ifndef AE_NEXT_TICK_H
2
+ #define AE_NEXT_TICK_H
3
+
4
+
5
+ void init_ae_next_tick();
6
+
7
+ VALUE AsyncEngine_c_next_tick(VALUE self);
8
+
9
+
10
+ #endif /* AE_NEXT_TICK_H */
@@ -0,0 +1,152 @@
1
+ #include "asyncengine_ruby.h"
2
+ #include "ae_handle_common.h"
3
+ #include "ae_timer.h"
4
+
5
+
6
+ static VALUE cAsyncEngineTimer;
7
+
8
+
9
+ typedef struct {
10
+ uv_timer_t *_uv_handle;
11
+ int periodic;
12
+ VALUE rb_block_id;
13
+ int has_rb_instance;
14
+ VALUE rb_instance; // Points to the owner AE::Timer (if there is).
15
+ } struct_ae_timer_cdata;
16
+
17
+
18
+ void init_ae_timer()
19
+ {
20
+ cAsyncEngineTimer = rb_define_class_under(mAsyncEngine, "Timer", rb_cObject);
21
+ rb_define_module_function(mAsyncEngine, "_c_add_timer", AsyncEngine_c_add_timer, 4);
22
+ rb_define_method(cAsyncEngineTimer, "cancel", AsyncEngineTimer_cancel, 0);
23
+ rb_define_alias(cAsyncEngineTimer, "stop", "cancel");
24
+ rb_define_private_method(cAsyncEngineTimer, "_c_set_interval", AsyncEngineTimer_c_set_interval, 1);
25
+ }
26
+
27
+
28
+ static
29
+ void deallocate(struct_ae_timer_cdata* cdata)
30
+ {
31
+ AE_TRACE();
32
+
33
+ // Let the GC work.
34
+ ae_remove_block(cdata->rb_block_id);
35
+ // Close the timer so it's unreferenced by uv.
36
+ uv_close((uv_handle_t *)cdata->_uv_handle, ae_handle_close_callback_0);
37
+ // Free memory.
38
+ xfree(cdata);
39
+ }
40
+
41
+
42
+ static
43
+ void execute_timer_with_gvl(uv_timer_t* handle)
44
+ {
45
+ AE_TRACE();
46
+
47
+ struct_ae_timer_cdata* cdata = (struct_ae_timer_cdata*)handle->data;
48
+ VALUE block = ae_get_block(cdata->rb_block_id);
49
+ int exception_tag;
50
+
51
+ exception_tag = ae_protect_block_call_0(block);
52
+
53
+ // Terminate the timer if it is not periodic.
54
+ if (cdata->periodic == 0) {
55
+ // If the timer has a ruby AE::Timer instance then set its attribute
56
+ // @_handle_terminated to true.
57
+ if (cdata->has_rb_instance == 1)
58
+ rb_ivar_set(cdata->rb_instance, att_handle_terminated, Qtrue);
59
+ deallocate(cdata);
60
+ }
61
+
62
+ if (exception_tag)
63
+ ae_manage_exception(exception_tag);
64
+ }
65
+
66
+
67
+ static
68
+ void timer_callback(uv_timer_t* handle, int status)
69
+ {
70
+ AE_TRACE();
71
+ rb_thread_call_with_gvl(execute_timer_with_gvl, handle);
72
+ }
73
+
74
+
75
+ VALUE AsyncEngine_c_add_timer(VALUE self, VALUE rb_delay, VALUE rb_interval, VALUE block, VALUE instance)
76
+ {
77
+ AE_TRACE();
78
+ uv_timer_t* _uv_handle = ALLOC(uv_timer_t);
79
+ struct_ae_timer_cdata* cdata = ALLOC(struct_ae_timer_cdata);
80
+ long delay, interval;
81
+
82
+ cdata->_uv_handle = _uv_handle;
83
+
84
+ delay = NUM2LONG(rb_delay);
85
+ if (NIL_P(rb_interval)) {
86
+ interval = 0;
87
+ cdata->periodic = 0;
88
+ }
89
+ else {
90
+ interval = NUM2LONG(rb_interval);
91
+ if (interval == 0) interval = 1;
92
+ cdata->periodic = 1;
93
+ }
94
+
95
+ // Save the block from being GC'd.
96
+ cdata->rb_block_id = ae_store_block(block);
97
+
98
+ if (NIL_P(instance))
99
+ cdata->has_rb_instance = 0;
100
+ else {
101
+ cdata->has_rb_instance = 1;
102
+ cdata->rb_instance = instance;
103
+ }
104
+
105
+ // Initialize.
106
+ uv_timer_init(uv_default_loop(), _uv_handle);
107
+ _uv_handle->data = cdata;
108
+
109
+ uv_timer_start(_uv_handle, timer_callback, delay, interval);
110
+
111
+ return Data_Wrap_Struct(cAsyncEngineCData, NULL, NULL, cdata);
112
+ }
113
+
114
+
115
+ VALUE AsyncEngineTimer_cancel(VALUE self)
116
+ {
117
+ AE_TRACE();
118
+ struct_ae_timer_cdata* cdata;
119
+
120
+ if (! NIL_P(rb_ivar_get(self, att_handle_terminated)))
121
+ return Qfalse;
122
+ rb_ivar_set(self, att_handle_terminated, Qtrue);
123
+
124
+ Data_Get_Struct(rb_ivar_get(self, att_cdata), struct_ae_timer_cdata, cdata);
125
+
126
+ // Stop timer.
127
+ uv_timer_stop(cdata->_uv_handle);
128
+
129
+ // Terminate the timer.
130
+ deallocate(cdata);
131
+
132
+ return Qtrue;
133
+ }
134
+
135
+
136
+ VALUE AsyncEngineTimer_c_set_interval(VALUE self, VALUE rb_interval)
137
+ {
138
+ AE_TRACE();
139
+ struct_ae_timer_cdata* cdata;
140
+ long interval;
141
+
142
+ if (! NIL_P(rb_ivar_get(self, att_handle_terminated)))
143
+ return Qfalse;
144
+
145
+ Data_Get_Struct(rb_ivar_get(self, att_cdata), struct_ae_timer_cdata, cdata);
146
+
147
+ interval = NUM2LONG(rb_interval);
148
+ if (interval == 0) interval = 1;
149
+
150
+ uv_timer_set_repeat(cdata->_uv_handle, interval);
151
+ return rb_interval;
152
+ }
@@ -0,0 +1,12 @@
1
+ #ifndef AE_TIMER_H
2
+ #define AE_TIMER_H
3
+
4
+
5
+ void init_ae_timer();
6
+
7
+ VALUE AsyncEngine_c_add_timer(VALUE self, VALUE delay, VALUE interval, VALUE block, VALUE instance);
8
+ VALUE AsyncEngineTimer_cancel(VALUE self);
9
+ VALUE AsyncEngineTimer_c_set_interval(VALUE self, VALUE interval);
10
+
11
+
12
+ #endif /* AE_TIMER_H */
@@ -0,0 +1,24 @@
1
+ #include "asyncengine_ruby.h"
2
+ #include "ae_handle_common.h"
3
+ #include "ae_udp.h"
4
+
5
+
6
+ void init_ae_udp()
7
+ {
8
+ rb_define_module_function(mAsyncEngine, "test_ipv4", AsyncEngine_test_ipv4, 2);
9
+ }
10
+
11
+
12
+ VALUE AsyncEngine_test_ipv4(VALUE self, VALUE rb_ip, VALUE rb_port)
13
+ {
14
+ char* ip = StringValueCStr(rb_ip);
15
+ int port = FIX2INT(rb_port);
16
+ struct sockaddr_in addr;
17
+
18
+ //printf("AsyncEngine_ip4(): ip=%s, port=%d\n", ip, port);
19
+ /* Convert string ip addresses to binary structures */
20
+
21
+ //UV_EXTERN struct sockaddr_in uv_ip4_addr(const char* ip, int port);
22
+ addr = uv_ip4_addr(ip, port);
23
+
24
+ }
@@ -0,0 +1,10 @@
1
+ #ifndef AE_UDP_H
2
+ #define AE_UDP_H
3
+
4
+
5
+ void init_ae_udp();
6
+
7
+ VALUE AsyncEngine_test_ipv4(VALUE self, VALUE rb_ip, VALUE rb_port);
8
+
9
+
10
+ #endif /* AE_UDP_H */
@@ -0,0 +1,72 @@
1
+ #include "asyncengine_ruby.h"
2
+ #include "ae_handle_common.h"
3
+ #include "ae_timer.h"
4
+ #include "ae_next_tick.h"
5
+ #include "ae_udp.h"
6
+
7
+
8
+ static
9
+ void prepare_callback(uv_prepare_t* handle, int status)
10
+ {
11
+ AE_TRACE();
12
+
13
+ // Check received interruptions in Ruby land.
14
+ rb_thread_call_with_gvl(rb_thread_check_ints, NULL);
15
+
16
+ // If this uv_prepare is the only existing handle, then terminate the loop.
17
+ if (uv_loop_refcount(uv_default_loop()) == 1)
18
+ uv_close((uv_handle_t *)handle, ae_handle_close_callback_0);
19
+ }
20
+
21
+
22
+ static
23
+ VALUE run_uv_without_gvl(void* param)
24
+ {
25
+ AE_TRACE();
26
+
27
+ if (! uv_run(uv_default_loop())) {
28
+ return Qtrue;
29
+ }
30
+ else
31
+ return Qfalse;
32
+ }
33
+
34
+
35
+ VALUE AsyncEngine_c_run(VALUE self)
36
+ {
37
+ AE_TRACE();
38
+ uv_prepare_t *_uv_prepare = ALLOC(uv_prepare_t);
39
+
40
+ uv_prepare_init(uv_default_loop(), _uv_prepare);
41
+ uv_prepare_start(_uv_prepare, prepare_callback);
42
+
43
+ return rb_thread_call_without_gvl(run_uv_without_gvl, NULL, RUBY_UBF_IO, NULL);
44
+ }
45
+
46
+
47
+ /*
48
+ * Returns the number of handlers in the loop.
49
+ * NOTE: The returned number is the real number of handles minus 1 (the prepare handle).
50
+ */
51
+ VALUE AsyncEngine_num_handles(VALUE self)
52
+ {
53
+ return INT2FIX(uv_loop_refcount(uv_default_loop()) - 1);
54
+ }
55
+
56
+
57
+
58
+
59
+ void Init_asyncengine_ext()
60
+ {
61
+ AE_TRACE();
62
+
63
+ mAsyncEngine = rb_define_module("AsyncEngine");
64
+
65
+ rb_define_module_function(mAsyncEngine, "_c_run", AsyncEngine_c_run, 0);
66
+ rb_define_module_function(mAsyncEngine, "num_handles", AsyncEngine_num_handles, 0);
67
+
68
+ init_ae_handle_common();
69
+ init_ae_timer();
70
+ init_ae_next_tick();
71
+ init_ae_udp();
72
+ }
@@ -0,0 +1,22 @@
1
+ #ifndef ASYNCENGINE_RUBY_H
2
+ #define ASYNCENGINE_RUBY_H
3
+
4
+
5
+ #include <ruby.h>
6
+ #include <libuv/include/uv.h> // NOTE: Not needed if dir_config() line is enabled in extconf.rb.
7
+ //#include <uv.h> // so this line becomes enough.
8
+
9
+
10
+ // Uncomment this line for enabling TRACE() function.
11
+ //#define AE_DEBUG
12
+ #ifdef AE_DEBUG
13
+ #define AE_TRACE() fprintf(stderr, "AE_TRACE: %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
14
+ #else
15
+ #define AE_TRACE()
16
+ #endif
17
+
18
+
19
+ VALUE mAsyncEngine;
20
+
21
+
22
+ #endif /* #ifndef ASYNCENGINE_RUBY_H */
@@ -4,7 +4,7 @@ require "fileutils"
4
4
 
5
5
 
6
6
  def sys cmd
7
- puts "system command: #{cmd}"
7
+ puts "system command in #{File.expand_path(File.dirname(__FILE__))}: #{cmd}"
8
8
  unless ret = xsystem(cmd)
9
9
  raise "system command `#{cmd}' failed, please report to https://github.com/ibc/AsyncEngine/issues"
10
10
  end
@@ -35,13 +35,13 @@ end
35
35
  $CFLAGS = RbConfig::CONFIG["CFLAGS"] = " #{cflags} "
36
36
  $LDFLAGS = RbConfig::CONFIG["LDFLAGS"] = " #{ldflags} "
37
37
 
38
- here = File.expand_path(File.dirname(__FILE__), "libuv/")
39
-
40
- Dir.chdir(here) do
38
+ libuv_dir = File.expand_path(File.dirname(__FILE__), "libuv/")
39
+ Dir.chdir(libuv_dir) do
41
40
  sys "CFLAGS='#{cflags}' make"
42
41
  FileUtils.mv "uv.a", "../libuv.a"
43
42
  end
44
43
 
45
- dir_config("uv", File.expand_path("../libuv/include", __FILE__), File.expand_path("../libuv", __FILE__))
46
- have_library("uv")
47
- create_makefile("asyncengine_ext")
44
+ #dir_config("uv", File.expand_path("../libuv/include", __FILE__), File.expand_path("../libuv", __FILE__))
45
+ have_library("uv") or raise "have_library('uv') returns false"
46
+
47
+ create_makefile("asyncengine/asyncengine_ext")
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,24 @@
1
+ "CFLAGS='-shared -fPIC' make"
2
+ ar rcs uv.a src/unix/async.o src/unix/cares.o src/unix/check.o src/unix/core.o src/unix/dl.o src/unix/error.o src/unix/fs.o src/unix/idle.o src/unix/loop.o src/unix/pipe.o src/unix/prepare.o src/unix/process.o src/unix/stream.o src/unix/tcp.o src/unix/thread.o src/unix/timer.o src/unix/tty.o src/unix/udp.o src/unix/linux/core.o src/unix/linux/inotify.o src/unix/linux/syscalls.o src/uv-common.o src/unix/uv-eio.o src/unix/ev/ev.o src/unix/eio/eio.o src/ares/ares__close_sockets.o src/ares/ares__get_hostent.o src/ares/ares__read_line.o src/ares/ares__timeval.o src/ares/ares_cancel.o src/ares/ares_data.o src/ares/ares_destroy.o src/ares/ares_expand_name.o src/ares/ares_expand_string.o src/ares/ares_fds.o src/ares/ares_free_hostent.o src/ares/ares_free_string.o src/ares/ares_gethostbyaddr.o src/ares/ares_gethostbyname.o src/ares/ares_getnameinfo.o src/ares/ares_getopt.o src/ares/ares_getsock.o src/ares/ares_init.o src/ares/ares_library_init.o src/ares/ares_llist.o src/ares/ares_mkquery.o src/ares/ares_nowarn.o src/ares/ares_options.o src/ares/ares_parse_a_reply.o src/ares/ares_parse_aaaa_reply.o src/ares/ares_parse_mx_reply.o src/ares/ares_parse_ns_reply.o src/ares/ares_parse_ptr_reply.o src/ares/ares_parse_srv_reply.o src/ares/ares_parse_txt_reply.o src/ares/ares_process.o src/ares/ares_query.o src/ares/ares_search.o src/ares/ares_send.o src/ares/ares_strcasecmp.o src/ares/ares_strdup.o src/ares/ares_strerror.o src/ares/ares_timeout.o src/ares/ares_version.o src/ares/ares_writev.o src/ares/bitncmp.o src/ares/inet_net_pton.o src/ares/inet_ntop.o
3
+ have_library: checking for main() in -luv... -------------------- yes
4
+
5
+ "gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -shared -fPIC conftest.c -L. -L/usr/lib -lruby-1.9.1-static -lpthread -lrt -ldl -lcrypt -lm -lc"
6
+ checked program was:
7
+ /* begin */
8
+ 1: #include "ruby.h"
9
+ 2:
10
+ 3: int main() {return 0;}
11
+ /* end */
12
+
13
+ "gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -shared -fPIC conftest.c -L. -L/usr/lib -lruby-1.9.1-static -luv -lpthread -lrt -ldl -lcrypt -lm -lc"
14
+ checked program was:
15
+ /* begin */
16
+ 1: #include "ruby.h"
17
+ 2:
18
+ 3: /*top*/
19
+ 4: int main() {return 0;}
20
+ 5: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
21
+ /* end */
22
+
23
+ --------------------
24
+