rev 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. data/README +4 -0
  2. data/ext/rev/rev_buffer.c +21 -8
  3. data/ext/rev/rev_watcher.c +23 -6
  4. data/ext/rev/rev_watcher.h +5 -13
  5. data/lib/rev.rb +1 -1
  6. data/lib/rev/buffered_io.rb +8 -12
  7. data/lib/rev_ext.bundle +0 -0
  8. metadata +2 -226
  9. data/doc/rdoc/classes/Rev.html +0 -368
  10. data/doc/rdoc/classes/Rev.src/M000001.html +0 -28
  11. data/doc/rdoc/classes/Rev.src/M000002.html +0 -35
  12. data/doc/rdoc/classes/Rev.src/M000003.html +0 -24
  13. data/doc/rdoc/classes/Rev.src/M000004.html +0 -28
  14. data/doc/rdoc/classes/Rev.src/M000005.html +0 -27
  15. data/doc/rdoc/classes/Rev.src/M000006.html +0 -33
  16. data/doc/rdoc/classes/Rev.src/M000007.html +0 -43
  17. data/doc/rdoc/classes/Rev.src/M000008.html +0 -16
  18. data/doc/rdoc/classes/Rev/Buffer.html +0 -354
  19. data/doc/rdoc/classes/Rev/Buffer.src/M000019.html +0 -17
  20. data/doc/rdoc/classes/Rev/Buffer.src/M000020.html +0 -29
  21. data/doc/rdoc/classes/Rev/Buffer.src/M000021.html +0 -27
  22. data/doc/rdoc/classes/Rev/Buffer.src/M000022.html +0 -27
  23. data/doc/rdoc/classes/Rev/Buffer.src/M000023.html +0 -31
  24. data/doc/rdoc/classes/Rev/Buffer.src/M000024.html +0 -31
  25. data/doc/rdoc/classes/Rev/Buffer.src/M000025.html +0 -30
  26. data/doc/rdoc/classes/Rev/Buffer.src/M000026.html +0 -50
  27. data/doc/rdoc/classes/Rev/Buffer.src/M000027.html +0 -22
  28. data/doc/rdoc/classes/Rev/Buffer.src/M000028.html +0 -24
  29. data/doc/rdoc/classes/Rev/Buffer.src/M000029.html +0 -24
  30. data/doc/rdoc/classes/Rev/BufferedIO.html +0 -397
  31. data/doc/rdoc/classes/Rev/BufferedIO.src/M000095.html +0 -23
  32. data/doc/rdoc/classes/Rev/BufferedIO.src/M000096.html +0 -16
  33. data/doc/rdoc/classes/Rev/BufferedIO.src/M000097.html +0 -16
  34. data/doc/rdoc/classes/Rev/BufferedIO.src/M000098.html +0 -16
  35. data/doc/rdoc/classes/Rev/BufferedIO.src/M000099.html +0 -18
  36. data/doc/rdoc/classes/Rev/BufferedIO.src/M000100.html +0 -18
  37. data/doc/rdoc/classes/Rev/BufferedIO.src/M000101.html +0 -23
  38. data/doc/rdoc/classes/Rev/BufferedIO.src/M000102.html +0 -18
  39. data/doc/rdoc/classes/Rev/BufferedIO.src/M000103.html +0 -20
  40. data/doc/rdoc/classes/Rev/BufferedIO.src/M000104.html +0 -24
  41. data/doc/rdoc/classes/Rev/BufferedIO.src/M000105.html +0 -23
  42. data/doc/rdoc/classes/Rev/BufferedIO.src/M000106.html +0 -22
  43. data/doc/rdoc/classes/Rev/BufferedIO.src/M000107.html +0 -29
  44. data/doc/rdoc/classes/Rev/BufferedIO/Writer.html +0 -154
  45. data/doc/rdoc/classes/Rev/BufferedIO/Writer.src/M000108.html +0 -19
  46. data/doc/rdoc/classes/Rev/BufferedIO/Writer.src/M000109.html +0 -18
  47. data/doc/rdoc/classes/Rev/DNSResolver.html +0 -401
  48. data/doc/rdoc/classes/Rev/DNSResolver.src/M000124.html +0 -25
  49. data/doc/rdoc/classes/Rev/DNSResolver.src/M000125.html +0 -29
  50. data/doc/rdoc/classes/Rev/DNSResolver.src/M000126.html +0 -20
  51. data/doc/rdoc/classes/Rev/DNSResolver.src/M000127.html +0 -19
  52. data/doc/rdoc/classes/Rev/DNSResolver.src/M000128.html +0 -16
  53. data/doc/rdoc/classes/Rev/DNSResolver.src/M000129.html +0 -16
  54. data/doc/rdoc/classes/Rev/DNSResolver.src/M000131.html +0 -19
  55. data/doc/rdoc/classes/Rev/DNSResolver.src/M000132.html +0 -21
  56. data/doc/rdoc/classes/Rev/DNSResolver.src/M000133.html +0 -27
  57. data/doc/rdoc/classes/Rev/DNSResolver.src/M000134.html +0 -28
  58. data/doc/rdoc/classes/Rev/DNSResolver.src/M000135.html +0 -55
  59. data/doc/rdoc/classes/Rev/DNSResolver/Timeout.html +0 -154
  60. data/doc/rdoc/classes/Rev/DNSResolver/Timeout.src/M000136.html +0 -20
  61. data/doc/rdoc/classes/Rev/DNSResolver/Timeout.src/M000137.html +0 -22
  62. data/doc/rdoc/classes/Rev/HttpChunkHeader.html +0 -156
  63. data/doc/rdoc/classes/Rev/HttpChunkHeader.src/M000031.html +0 -19
  64. data/doc/rdoc/classes/Rev/HttpClient.html +0 -460
  65. data/doc/rdoc/classes/Rev/HttpClient.src/M000042.html +0 -18
  66. data/doc/rdoc/classes/Rev/HttpClient.src/M000043.html +0 -27
  67. data/doc/rdoc/classes/Rev/HttpClient.src/M000044.html +0 -24
  68. data/doc/rdoc/classes/Rev/HttpClient.src/M000045.html +0 -19
  69. data/doc/rdoc/classes/Rev/HttpClient.src/M000046.html +0 -17
  70. data/doc/rdoc/classes/Rev/HttpClient.src/M000047.html +0 -19
  71. data/doc/rdoc/classes/Rev/HttpClient.src/M000048.html +0 -18
  72. data/doc/rdoc/classes/Rev/HttpClient.src/M000049.html +0 -18
  73. data/doc/rdoc/classes/Rev/HttpClient.src/M000050.html +0 -19
  74. data/doc/rdoc/classes/Rev/HttpClient.src/M000051.html +0 -19
  75. data/doc/rdoc/classes/Rev/HttpClient.src/M000052.html +0 -19
  76. data/doc/rdoc/classes/Rev/HttpClient.src/M000053.html +0 -41
  77. data/doc/rdoc/classes/Rev/HttpClient.src/M000054.html +0 -18
  78. data/doc/rdoc/classes/Rev/HttpClient.src/M000055.html +0 -34
  79. data/doc/rdoc/classes/Rev/HttpEncoding.html +0 -310
  80. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000009.html +0 -20
  81. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000010.html +0 -20
  82. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000011.html +0 -18
  83. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000012.html +0 -18
  84. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000013.html +0 -18
  85. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000014.html +0 -19
  86. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000015.html +0 -18
  87. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000016.html +0 -18
  88. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000017.html +0 -22
  89. data/doc/rdoc/classes/Rev/HttpEncoding.src/M000018.html +0 -18
  90. data/doc/rdoc/classes/Rev/HttpResponseHeader.html +0 -219
  91. data/doc/rdoc/classes/Rev/HttpResponseHeader.src/M000032.html +0 -18
  92. data/doc/rdoc/classes/Rev/HttpResponseHeader.src/M000033.html +0 -18
  93. data/doc/rdoc/classes/Rev/HttpResponseHeader.src/M000034.html +0 -18
  94. data/doc/rdoc/classes/Rev/IOWatcher.html +0 -285
  95. data/doc/rdoc/classes/Rev/IOWatcher.src/M000079.html +0 -17
  96. data/doc/rdoc/classes/Rev/IOWatcher.src/M000080.html +0 -27
  97. data/doc/rdoc/classes/Rev/IOWatcher.src/M000081.html +0 -26
  98. data/doc/rdoc/classes/Rev/IOWatcher.src/M000082.html +0 -27
  99. data/doc/rdoc/classes/Rev/IOWatcher.src/M000083.html +0 -27
  100. data/doc/rdoc/classes/Rev/IOWatcher.src/M000084.html +0 -24
  101. data/doc/rdoc/classes/Rev/IOWatcher.src/M000085.html +0 -25
  102. data/doc/rdoc/classes/Rev/Listener.html +0 -207
  103. data/doc/rdoc/classes/Rev/Listener.src/M000065.html +0 -19
  104. data/doc/rdoc/classes/Rev/Listener.src/M000066.html +0 -19
  105. data/doc/rdoc/classes/Rev/Listener.src/M000067.html +0 -16
  106. data/doc/rdoc/classes/Rev/Listener.src/M000068.html +0 -18
  107. data/doc/rdoc/classes/Rev/Loop.html +0 -395
  108. data/doc/rdoc/classes/Rev/Loop.src/M000070.html +0 -25
  109. data/doc/rdoc/classes/Rev/Loop.src/M000071.html +0 -45
  110. data/doc/rdoc/classes/Rev/Loop.src/M000072.html +0 -18
  111. data/doc/rdoc/classes/Rev/Loop.src/M000073.html +0 -23
  112. data/doc/rdoc/classes/Rev/Loop.src/M000074.html +0 -19
  113. data/doc/rdoc/classes/Rev/Loop.src/M000075.html +0 -17
  114. data/doc/rdoc/classes/Rev/Loop.src/M000076.html +0 -27
  115. data/doc/rdoc/classes/Rev/Loop.src/M000077.html +0 -32
  116. data/doc/rdoc/classes/Rev/Loop.src/M000078.html +0 -32
  117. data/doc/rdoc/classes/Rev/Server.html +0 -164
  118. data/doc/rdoc/classes/Rev/Server.src/M000121.html +0 -32
  119. data/doc/rdoc/classes/Rev/Server.src/M000122.html +0 -20
  120. data/doc/rdoc/classes/Rev/Socket.html +0 -213
  121. data/doc/rdoc/classes/Rev/Socket.src/M000035.html +0 -21
  122. data/doc/rdoc/classes/Rev/Socket.src/M000036.html +0 -25
  123. data/doc/rdoc/classes/Rev/Socket.src/M000037.html +0 -16
  124. data/doc/rdoc/classes/Rev/Socket.src/M000038.html +0 -16
  125. data/doc/rdoc/classes/Rev/Socket/Connector.html +0 -154
  126. data/doc/rdoc/classes/Rev/Socket/Connector.src/M000040.html +0 -19
  127. data/doc/rdoc/classes/Rev/Socket/Connector.src/M000041.html +0 -28
  128. data/doc/rdoc/classes/Rev/TCPListener.html +0 -161
  129. data/doc/rdoc/classes/Rev/TCPListener.src/M000069.html +0 -23
  130. data/doc/rdoc/classes/Rev/TCPServer.html +0 -147
  131. data/doc/rdoc/classes/Rev/TCPServer.src/M000123.html +0 -20
  132. data/doc/rdoc/classes/Rev/TCPSocket.html +0 -233
  133. data/doc/rdoc/classes/Rev/TCPSocket.src/M000056.html +0 -20
  134. data/doc/rdoc/classes/Rev/TCPSocket.src/M000057.html +0 -34
  135. data/doc/rdoc/classes/Rev/TCPSocket.src/M000058.html +0 -24
  136. data/doc/rdoc/classes/Rev/TCPSocket.src/M000059.html +0 -18
  137. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectResolver.html +0 -171
  138. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectResolver.src/M000060.html +0 -19
  139. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectResolver.src/M000061.html +0 -27
  140. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectResolver.src/M000062.html +0 -23
  141. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectSocket.html +0 -154
  142. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectSocket.src/M000063.html +0 -25
  143. data/doc/rdoc/classes/Rev/TCPSocket/TCPConnectSocket.src/M000064.html +0 -23
  144. data/doc/rdoc/classes/Rev/TimerWatcher.html +0 -288
  145. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000086.html +0 -17
  146. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000087.html +0 -27
  147. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000088.html +0 -26
  148. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000089.html +0 -27
  149. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000090.html +0 -27
  150. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000091.html +0 -42
  151. data/doc/rdoc/classes/Rev/TimerWatcher.src/M000092.html +0 -24
  152. data/doc/rdoc/classes/Rev/UNIXListener.html +0 -147
  153. data/doc/rdoc/classes/Rev/UNIXListener.src/M000120.html +0 -18
  154. data/doc/rdoc/classes/Rev/UNIXServer.html +0 -147
  155. data/doc/rdoc/classes/Rev/UNIXServer.src/M000030.html +0 -18
  156. data/doc/rdoc/classes/Rev/UNIXSocket.html +0 -175
  157. data/doc/rdoc/classes/Rev/UNIXSocket.src/M000093.html +0 -18
  158. data/doc/rdoc/classes/Rev/UNIXSocket.src/M000094.html +0 -21
  159. data/doc/rdoc/classes/Rev/Watcher.html +0 -349
  160. data/doc/rdoc/classes/Rev/Watcher.src/M000110.html +0 -20
  161. data/doc/rdoc/classes/Rev/Watcher.src/M000111.html +0 -20
  162. data/doc/rdoc/classes/Rev/Watcher.src/M000112.html +0 -17
  163. data/doc/rdoc/classes/Rev/Watcher.src/M000113.html +0 -48
  164. data/doc/rdoc/classes/Rev/Watcher.src/M000114.html +0 -62
  165. data/doc/rdoc/classes/Rev/Watcher.src/M000115.html +0 -34
  166. data/doc/rdoc/classes/Rev/Watcher.src/M000116.html +0 -34
  167. data/doc/rdoc/classes/Rev/Watcher.src/M000117.html +0 -27
  168. data/doc/rdoc/classes/Rev/Watcher.src/M000118.html +0 -24
  169. data/doc/rdoc/classes/Rev/Watcher.src/M000119.html +0 -27
  170. data/doc/rdoc/created.rid +0 -1
  171. data/doc/rdoc/files/LICENSE.html +0 -165
  172. data/doc/rdoc/files/README.html +0 -297
  173. data/doc/rdoc/files/ext/rev/rev_buffer_c.html +0 -101
  174. data/doc/rdoc/files/ext/rev/rev_ext_c.html +0 -101
  175. data/doc/rdoc/files/ext/rev/rev_io_watcher_c.html +0 -101
  176. data/doc/rdoc/files/ext/rev/rev_loop_c.html +0 -101
  177. data/doc/rdoc/files/ext/rev/rev_timer_watcher_c.html +0 -101
  178. data/doc/rdoc/files/ext/rev/rev_watcher_c.html +0 -101
  179. data/doc/rdoc/files/lib/rev/buffered_io_rb.html +0 -101
  180. data/doc/rdoc/files/lib/rev/dns_resolver_rb.html +0 -101
  181. data/doc/rdoc/files/lib/rev/http_client_rb.html +0 -101
  182. data/doc/rdoc/files/lib/rev/io_watcher_rb.html +0 -101
  183. data/doc/rdoc/files/lib/rev/listener_rb.html +0 -108
  184. data/doc/rdoc/files/lib/rev/loop_rb.html +0 -101
  185. data/doc/rdoc/files/lib/rev/server_rb.html +0 -101
  186. data/doc/rdoc/files/lib/rev/socket_rb.html +0 -109
  187. data/doc/rdoc/files/lib/rev/timer_watcher_rb.html +0 -101
  188. data/doc/rdoc/files/lib/rev/watcher_rb.html +0 -101
  189. data/doc/rdoc/files/lib/rev_rb.html +0 -101
  190. data/doc/rdoc/fr_class_index.html +0 -52
  191. data/doc/rdoc/fr_file_index.html +0 -45
  192. data/doc/rdoc/fr_method_index.html +0 -163
  193. data/doc/rdoc/index.html +0 -24
  194. data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,48 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>attach (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.attach(loop) -&gt; Rev::Watcher
16
- *
17
- * Attach the watcher to the given Rev::Loop. If the watcher is already attached
18
- * to a loop, detach it from the old one and attach it to the new one.
19
- */
20
- static VALUE Rev_Watcher_attach(VALUE self, VALUE loop)
21
- {
22
- VALUE loop_watchers, active_watchers;
23
-
24
- loop_watchers = rb_iv_get(loop, &quot;@watchers&quot;);
25
-
26
- if(loop_watchers == Qnil) {
27
- loop_watchers = rb_ary_new();
28
- rb_iv_set(loop, &quot;@watchers&quot;, loop_watchers);
29
- }
30
-
31
- /* Add us to the loop's array of active watchers. This is mainly done
32
- * to keep the VM from garbage collecting watchers that are associated
33
- * with a loop (and also lets you see within Ruby which watchers are
34
- * associated with a given loop), but isn't really necessary for any
35
- * other reason */
36
- rb_ary_push(loop_watchers, self);
37
-
38
- active_watchers = rb_iv_get(loop, &quot;@active_watchers&quot;);
39
- if(active_watchers == Qnil)
40
- active_watchers = INT2NUM(1);
41
- else
42
- active_watchers = INT2NUM(NUM2INT(active_watchers) + 1);
43
- rb_iv_set(loop, &quot;@active_watchers&quot;, active_watchers);
44
-
45
- return self;
46
- }</pre>
47
- </body>
48
- </html>
@@ -1,62 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>detach (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.detach -&gt; Rev::Watcher
16
- *
17
- * Detach the watcher from its current Rev::Loop.
18
- */
19
- static VALUE Rev_Watcher_detach(VALUE self)
20
- {
21
- struct Rev_Watcher *watcher_data;
22
- struct Rev_Loop *loop_data;
23
- VALUE loop_watchers;
24
-
25
- int i;
26
-
27
- Data_Get_Struct(self, struct Rev_Watcher, watcher_data);
28
-
29
- if(watcher_data-&gt;loop == Qnil)
30
- rb_raise(rb_eRuntimeError, &quot;not attached to a loop&quot;);
31
-
32
- loop_watchers = rb_iv_get(watcher_data-&gt;loop, &quot;@watchers&quot;);
33
-
34
- /* Remove us from the loop's array of active watchers. This likely
35
- * has negative performance and scalability characteristics as this
36
- * isn't an O(1) operation. Hopefully there's a better way... */
37
- rb_ary_delete(loop_watchers, self);
38
-
39
- rb_iv_set(
40
- watcher_data-&gt;loop,
41
- &quot;@active_watchers&quot;,
42
- INT2NUM(NUM2INT(rb_iv_get(watcher_data-&gt;loop, &quot;@active_watchers&quot;)) - 1)
43
- );
44
-
45
- Data_Get_Struct(watcher_data-&gt;loop, struct Rev_Loop, loop_data);
46
-
47
- /* Iterate through the events in the loop's event buffer. If there
48
- * are any pending events from this watcher, mark them NULL. The
49
- * dispatch loop will skip them. This prevents watchers earlier
50
- * in the event buffer from detaching others which may have pending
51
- * events in the buffer but get garbage collected in the meantime */
52
- for(i = 0; i &lt; loop_data-&gt;events_received; i++) {
53
- if(loop_data-&gt;eventbuf[i].watcher == self)
54
- loop_data-&gt;eventbuf[i].watcher = Qnil;
55
- }
56
-
57
- watcher_data-&gt;loop = Qnil;
58
-
59
- return self;
60
- }</pre>
61
- </body>
62
- </html>
@@ -1,34 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>enable (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.enable -&gt; Rev::Watcher
16
- *
17
- * Re-enable a watcher which has been temporarily disabled. See the
18
- * disable method for a more thorough explanation.
19
- */
20
- static VALUE Rev_Watcher_enable(VALUE self)
21
- {
22
- struct Rev_Watcher *watcher_data;
23
- Data_Get_Struct(self, struct Rev_Watcher, watcher_data);
24
-
25
- rb_iv_set(
26
- watcher_data-&gt;loop,
27
- &quot;@active_watchers&quot;,
28
- INT2NUM(NUM2INT(rb_iv_get(watcher_data-&gt;loop, &quot;@active_watchers&quot;)) + 1)
29
- );
30
-
31
- return self;
32
- }</pre>
33
- </body>
34
- </html>
@@ -1,34 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>disable (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.disable -&gt; Rev::Watcher
16
- *
17
- * Temporarily disable an event watcher which is attached to a loop.
18
- * This is useful if you wish to toggle event monitoring on and off.
19
- */
20
- static VALUE Rev_Watcher_disable(VALUE self)
21
- {
22
- struct Rev_Watcher *watcher_data;
23
- Data_Get_Struct(self, struct Rev_Watcher, watcher_data);
24
-
25
- rb_iv_set(
26
- watcher_data-&gt;loop,
27
- &quot;@active_watchers&quot;,
28
- INT2NUM(NUM2INT(rb_iv_get(watcher_data-&gt;loop, &quot;@active_watchers&quot;)) - 1)
29
- );
30
-
31
- return self;
32
- }</pre>
33
- </body>
34
- </html>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>evloop (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.evloop -&gt; Rev::Loop
16
- *
17
- * Return the loop to which we're currently attached
18
- */
19
- static VALUE Rev_Watcher_evloop(VALUE self)
20
- {
21
- struct Rev_Watcher *watcher_data;
22
-
23
- Data_Get_Struct(self, struct Rev_Watcher, watcher_data);
24
- return watcher_data-&gt;loop;
25
- }</pre>
26
- </body>
27
- </html>
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>attached? (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.attached? -&gt; Boolean
16
- *
17
- * Is the watcher currently attached to an event loop?
18
- */
19
- static VALUE Rev_Watcher_attached(VALUE self)
20
- {
21
- return Rev_Watcher_evloop(self) != Qnil;
22
- }</pre>
23
- </body>
24
- </html>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>enabled? (Rev::Watcher)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre>/**
14
- * call-seq:
15
- * Rev::Watcher.enabled? -&gt; Boolean
16
- *
17
- * Is the watcher currently enabled?
18
- */
19
- static VALUE Rev_Watcher_enabled(VALUE self)
20
- {
21
- struct Rev_Watcher *watcher_data;
22
- Data_Get_Struct(self, struct Rev_Watcher, watcher_data);
23
-
24
- return watcher_data-&gt;enabled ? Qtrue : Qfalse;
25
- }</pre>
26
- </body>
27
- </html>
@@ -1 +0,0 @@
1
- Tue, 15 Jan 2008 01:24:06 -0700
@@ -1,165 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: LICENSE</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>LICENSE</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>LICENSE
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Tue Dec 18 11:39:01 -0700 2007</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <p>
73
- Ruby is copyrighted free software by Yukihiro Matsumoto
74
- &lt;matz@netlab.co.jp&gt;. You can redistribute it and/or modify it under
75
- either the terms of the GPL (see COPYING.txt file), or the conditions
76
- below:
77
- </p>
78
- <pre>
79
- 1. You may make and give away verbatim copies of the source form of the
80
- software without restriction, provided that you duplicate all of the
81
- original copyright notices and associated disclaimers.
82
-
83
- 2. You may modify your copy of the software in any way, provided that
84
- you do at least ONE of the following:
85
-
86
- a) place your modifications in the Public Domain or otherwise
87
- make them Freely Available, such as by posting said
88
- modifications to Usenet or an equivalent medium, or by allowing
89
- the author to include your modifications in the software.
90
-
91
- b) use the modified software only within your corporation or
92
- organization.
93
-
94
- c) rename any non-standard executables so the names do not conflict
95
- with standard executables, which must also be provided.
96
-
97
- d) make other distribution arrangements with the author.
98
-
99
- 3. You may distribute the software in object code or executable
100
- form, provided that you do at least ONE of the following:
101
-
102
- a) distribute the executables and library files of the software,
103
- together with instructions (in the manual page or equivalent)
104
- on where to get the original distribution.
105
-
106
- b) accompany the distribution with the machine-readable source of
107
- the software.
108
-
109
- c) give non-standard executables non-standard names, with
110
- instructions on where to get the original software distribution.
111
-
112
- d) make other distribution arrangements with the author.
113
-
114
- 4. You may modify and include the part of the software into any other
115
- software (possibly commercial). But some files in the distribution
116
- are not written by the author, so that they are not under this terms.
117
-
118
- They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
119
- files under the ./missing directory. See each file for the copying
120
- condition.
121
-
122
- 5. The scripts and library files supplied as input to or produced as
123
- output from the software do not automatically fall under the
124
- copyright of the software, but belong to whomever generated them,
125
- and may be sold commercially, and may be aggregated with this
126
- software.
127
-
128
- 6. THIS SOFTWARE IS PROVIDED &quot;AS IS&quot; AND WITHOUT ANY EXPRESS OR
129
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
130
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
131
- PURPOSE.
132
- </pre>
133
-
134
- </div>
135
-
136
-
137
- </div>
138
-
139
-
140
- </div>
141
-
142
-
143
- <!-- if includes -->
144
-
145
- <div id="section">
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
- <!-- if method_list -->
155
-
156
-
157
- </div>
158
-
159
-
160
- <div id="validator-badges">
161
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
162
- </div>
163
-
164
- </body>
165
- </html>
@@ -1,297 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: README</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>README</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>README
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Thu Jan 03 14:13:32 -0700 2008</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <h1><a href="../classes/Rev.html">Rev</a></h1>
73
- <p>
74
- <a href="../classes/Rev.html">Rev</a> is a high performance event library
75
- for Ruby 1.9. It uses the libev C library to handle support for underlying
76
- system calls. This includes the epoll system call for Linux, the kqueue
77
- system call for BSDs and OS X, and the completion ports interface for
78
- Solaris.
79
- </p>
80
- <p>
81
- <a href="../classes/Rev.html">Rev</a> also binds asynchronous wrappers to
82
- Ruby&#8216;s core socket classes so you can use them in conjunction with <a
83
- href="../classes/Rev.html">Rev</a> to build asynchronous event-driven
84
- applications.
85
- </p>
86
- <h2>Anatomy</h2>
87
- <p>
88
- <a href="../classes/Rev.html">Rev</a> builds on two core classes which bind
89
- to the libev API:
90
- </p>
91
- <ul>
92
- <li><a href="../classes/Rev/Loop.html">Rev::Loop</a> - This class represents an
93
- event loop which uses underlying high performance system calls to wait for
94
- events.
95
-
96
- </li>
97
- <li><a href="../classes/Rev/Watcher.html">Rev::Watcher</a> - This is the base
98
- class for event observers. Once you attach an event observer to a loop and
99
- start running it, you will begin receiving callbacks to particlar methods
100
- when events occur.
101
-
102
- </li>
103
- </ul>
104
- <h2>Watchers</h2>
105
- <p>
106
- There are presently two types of watchers:
107
- </p>
108
- <ul>
109
- <li><a href="../classes/Rev/IOWatcher.html">Rev::IOWatcher</a> - This class
110
- waits for an IO object to become readable, writable, or both.
111
-
112
- </li>
113
- <li><a href="../classes/Rev/TimerWatcher.html">Rev::TimerWatcher</a> - This
114
- class waits for a specified duration then fires an event. You can also
115
- configure it to fire an event at specified intervals.
116
-
117
- </li>
118
- </ul>
119
- <h2>Using Watchers</h2>
120
- <p>
121
- Watchers have five important methods:
122
- </p>
123
- <ul>
124
- <li>attach(loop) - This binds a watcher to the specified event loop. If the
125
- watcher is already bound to a loop it will be detached first, then attached
126
- to the new one.
127
-
128
- </li>
129
- <li>detach - This completely unbinds a watcher from an event loop.
130
-
131
- </li>
132
- <li>disable - This stops the watcher from receiving events but does not unbind
133
- it from the loop. If you are trying to toggle a watcher on and off,
134
- it&#8216;s best to use this method (and enable) as it performs better than
135
- completely removing the watcher from the event loop.
136
-
137
- </li>
138
- <li>enable - This re-enables a watcher which has been disabled in the past. The
139
- watcher must still be bound to an event loop.
140
-
141
- </li>
142
- <li>evloop - This returns the <a href="../classes/Rev/Loop.html">Rev::Loop</a>
143
- object which the watcher is currently bound to.
144
-
145
- </li>
146
- </ul>
147
- <h2>Asynchronous Wrappers</h2>
148
- <p>
149
- Several classes which provide asynchronous event-driven wrappers for
150
- Ruby&#8216;s core socket classes are also provided. Among these are:
151
- </p>
152
- <ul>
153
- <li><a href="../classes/Rev/TCPSocket.html">Rev::TCPSocket</a> - A buffered
154
- wrapper to core Ruby&#8216;s Socket class for use with TCP sockets. You can
155
- asynchronously create outgoing TCP connections using its
156
- Rev::TCPSocket.connect method. <a
157
- href="../classes/Rev/TCPSocket.html">Rev::TCPSocket</a> provides write
158
- buffering to ensure that writing never blocks, and has asynchronous
159
- callbacks for several events, including when the connection is opened (or
160
- failed), when data is received, when the write buffer has been written out
161
- completely, and when the connection closes.
162
-
163
- </li>
164
- <li><a href="../classes/Rev/TCPServer.html">Rev::TCPServer</a> - A wrapper for
165
- TCPServer which creates new instances of <a
166
- href="../classes/Rev/TCPSocket.html">Rev::TCPSocket</a> (or any subclass
167
- you wish to provide) whenever an incoming connection is received.
168
-
169
- </li>
170
- <li><a href="../classes/Rev/HttpClient.html">Rev::HttpClient</a> - An HTTP/1.1
171
- client with support for chunked encoding and streaming response processing
172
- through asynchronous callbacks.
173
-
174
- </li>
175
- </ul>
176
- <h2>Example Program</h2>
177
- <p>
178
- Below is an example of how to write an echo server:
179
- </p>
180
- <pre>
181
- HOST = 'localhost'
182
- PORT = 4321
183
-
184
- class EchoServerConnection &lt; Rev::TCPSocket
185
- def on_connect
186
- puts &quot;#{remote_addr}:#{remote_port} connected&quot;
187
- end
188
-
189
- def on_close
190
- puts &quot;#{remote_addr}:#{remote_port} disconnected&quot;
191
- end
192
-
193
- def on_read(data)
194
- write data
195
- end
196
- end
197
-
198
- server = Rev::TCPServer.new('localhost', PORT, EchoServerConnection)
199
- server.attach(Rev::Loop.default)
200
-
201
- puts &quot;Echo server listening on #{HOST}:#{PORT}&quot;
202
- Rev::Loop.default.run
203
- </pre>
204
- <p>
205
- Here a new observer type (EchoServerConnection) is made by subclassing an
206
- existing one and adding new implementations to existing event handlers.
207
- </p>
208
- <p>
209
- A new event loop is created, and a new <a
210
- href="../classes/Rev/TCPServer.html">Rev::TCPServer</a> (whose base class
211
- is <a href="../classes/Rev/Watcher.html">Rev::Watcher</a>) is created and
212
- attached to the event loop.
213
- </p>
214
- <p>
215
- Once this is done, the event loop is started with event_loop.run. This
216
- method will block until there are no active watchers for the loop or the
217
- loop is stopped explicitly with event_loop.stop.
218
- </p>
219
- <h2>Defining Callbacks at Runtime</h2>
220
- <p>
221
- It&#8216;s often tedious to subclass in order to just change one callback.
222
- <a href="../classes/Rev.html">Rev</a> gives you the ability to change event
223
- callbacks on the fly (provided you haven&#8216;t overridden them in a
224
- subclass). This is especially useful for small one off programs or just
225
- experimenting with the API.
226
- </p>
227
- <p>
228
- Any callback (methods prefixed with on_*) can be set on the fly by passing
229
- it a block.
230
- </p>
231
- <p>
232
- Below is an example of using this syntax. It implements an echo server
233
- identical to the one above:
234
- </p>
235
- <pre>
236
- HOST = '127.0.0.1'
237
- PORT = 4321
238
-
239
- server = Rev::TCPServer.new(ADDR, PORT) do |c|
240
- c.on_connect { puts &quot;#{remote_addr}:#{remote_port} connected&quot; }
241
- c.on_close { puts &quot;#{remote_addr}:#{remote_port} disconnected&quot; }
242
- c.on_read { |data| write data }
243
- end
244
-
245
- server.attach(Rev::Loop.default)
246
-
247
- puts &quot;Echo server listening on #{HOST}:#{PORT}&quot;
248
- Rev::Loop.default.run
249
- </pre>
250
- <p>
251
- As you can see, it provides a more concise (albeint slightly slower)
252
- expression of the same server as above, without the need to subclass.
253
- </p>
254
- <p>
255
- <a href="../classes/Rev/TCPServer.html">Rev::TCPServer</a> will
256
- automatically yield new connections if a block is given. In this case the
257
- &quot;c&quot; variable being passed to the block is a new instance of <a
258
- href="../classes/Rev/TCPSocket.html">Rev::TCPSocket</a> representing the
259
- newly created connection.
260
- </p>
261
- <p>
262
- The above example sets the on_connect, on_close, and on_read callbacks each
263
- time a new connection is created.
264
- </p>
265
-
266
- </div>
267
-
268
-
269
- </div>
270
-
271
-
272
- </div>
273
-
274
-
275
- <!-- if includes -->
276
-
277
- <div id="section">
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
- <!-- if method_list -->
287
-
288
-
289
- </div>
290
-
291
-
292
- <div id="validator-badges">
293
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
294
- </div>
295
-
296
- </body>
297
- </html>