eventmachine 0.12.10-x86-mswin32-60 → 1.0.0.beta.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +1 -0
  3. data/README +80 -81
  4. data/Rakefile +7 -370
  5. data/docs/COPYING +60 -60
  6. data/docs/ChangeLog +211 -211
  7. data/docs/DEFERRABLES +246 -133
  8. data/docs/EPOLL +141 -141
  9. data/docs/GNU +281 -281
  10. data/docs/INSTALL +13 -13
  11. data/docs/KEYBOARD +42 -38
  12. data/docs/LEGAL +25 -25
  13. data/docs/LIGHTWEIGHT_CONCURRENCY +130 -70
  14. data/docs/PURE_RUBY +75 -75
  15. data/docs/RELEASE_NOTES +94 -94
  16. data/docs/SMTP +4 -2
  17. data/docs/SPAWNED_PROCESSES +148 -89
  18. data/docs/TODO +8 -8
  19. data/eventmachine.gemspec +19 -26
  20. data/examples/ex_channel.rb +42 -42
  21. data/examples/ex_queue.rb +2 -2
  22. data/examples/ex_tick_loop_array.rb +15 -0
  23. data/examples/ex_tick_loop_counter.rb +32 -0
  24. data/examples/helper.rb +1 -1
  25. data/ext/binder.cpp +0 -1
  26. data/ext/cmain.cpp +36 -25
  27. data/ext/ed.cpp +104 -113
  28. data/ext/ed.h +24 -30
  29. data/ext/em.cpp +349 -283
  30. data/ext/em.h +25 -29
  31. data/ext/eventmachine.h +5 -4
  32. data/ext/extconf.rb +58 -49
  33. data/ext/fastfilereader/extconf.rb +5 -3
  34. data/ext/fastfilereader/mapper.cpp +214 -214
  35. data/ext/fastfilereader/mapper.h +59 -59
  36. data/ext/fastfilereader/rubymain.cpp +127 -127
  37. data/ext/kb.cpp +1 -3
  38. data/ext/page.cpp +107 -107
  39. data/ext/page.h +51 -51
  40. data/ext/pipe.cpp +9 -11
  41. data/ext/project.h +12 -8
  42. data/ext/rubymain.cpp +138 -104
  43. data/java/.classpath +8 -8
  44. data/java/.project +17 -17
  45. data/java/src/com/rubyeventmachine/EmReactor.java +1 -0
  46. data/java/src/com/rubyeventmachine/EmReactorException.java +40 -40
  47. data/lib/em/buftok.rb +138 -138
  48. data/lib/em/callback.rb +25 -25
  49. data/lib/em/channel.rb +1 -1
  50. data/lib/em/connection.rb +6 -1
  51. data/lib/em/deferrable.rb +16 -2
  52. data/lib/em/file_watch.rb +53 -53
  53. data/lib/em/future.rb +61 -61
  54. data/lib/em/iterator.rb +270 -0
  55. data/lib/em/messages.rb +66 -66
  56. data/lib/em/process_watch.rb +43 -43
  57. data/lib/em/protocols.rb +1 -1
  58. data/lib/em/protocols/header_and_content.rb +138 -138
  59. data/lib/em/protocols/httpclient.rb +267 -262
  60. data/lib/em/protocols/line_protocol.rb +28 -0
  61. data/lib/em/protocols/memcache.rb +322 -322
  62. data/lib/em/protocols/postgres3.rb +247 -247
  63. data/lib/em/protocols/saslauth.rb +175 -175
  64. data/lib/em/protocols/smtpserver.rb +640 -547
  65. data/lib/em/protocols/stomp.rb +200 -200
  66. data/lib/em/protocols/tcptest.rb +52 -52
  67. data/lib/{pr_eventmachine.rb → em/pure_ruby.rb} +1013 -1022
  68. data/lib/em/queue.rb +1 -0
  69. data/lib/em/spawnable.rb +85 -85
  70. data/lib/em/streamer.rb +130 -130
  71. data/lib/em/tick_loop.rb +85 -0
  72. data/lib/em/timers.rb +2 -1
  73. data/lib/em/version.rb +1 -1
  74. data/lib/eventmachine.rb +40 -84
  75. data/lib/jeventmachine.rb +2 -1
  76. data/lib/rubyeventmachine.rb +2 -0
  77. data/setup.rb +1585 -1585
  78. data/tasks/doc.rake +30 -0
  79. data/tasks/package.rake +85 -0
  80. data/tasks/test.rake +6 -0
  81. data/tests/client.crt +31 -31
  82. data/tests/client.key +51 -51
  83. data/tests/test_attach.rb +13 -3
  84. data/tests/test_basic.rb +60 -95
  85. data/tests/test_channel.rb +3 -2
  86. data/tests/test_defer.rb +49 -47
  87. data/tests/test_deferrable.rb +35 -0
  88. data/tests/test_error_handler.rb +35 -35
  89. data/tests/test_errors.rb +82 -82
  90. data/tests/test_exc.rb +55 -55
  91. data/tests/test_file_watch.rb +49 -49
  92. data/tests/test_futures.rb +198 -198
  93. data/tests/test_handler_check.rb +36 -36
  94. data/tests/test_hc.rb +190 -218
  95. data/tests/test_httpclient.rb +227 -218
  96. data/tests/test_httpclient2.rb +3 -2
  97. data/tests/test_inactivity_timeout.rb +3 -3
  98. data/tests/test_kb.rb +60 -60
  99. data/tests/test_ltp.rb +13 -5
  100. data/tests/test_ltp2.rb +317 -317
  101. data/tests/test_next_tick.rb +1 -1
  102. data/tests/test_object_protocol.rb +36 -36
  103. data/tests/test_pending_connect_timeout.rb +2 -2
  104. data/tests/test_process_watch.rb +50 -48
  105. data/tests/test_proxy_connection.rb +52 -0
  106. data/tests/test_pure.rb +134 -125
  107. data/tests/test_queue.rb +44 -44
  108. data/tests/test_running.rb +42 -42
  109. data/tests/test_sasl.rb +72 -72
  110. data/tests/test_send_file.rb +251 -242
  111. data/tests/test_servers.rb +76 -76
  112. data/tests/test_smtpclient.rb +83 -83
  113. data/tests/test_smtpserver.rb +85 -85
  114. data/tests/test_spawn.rb +322 -322
  115. data/tests/test_ssl_methods.rb +49 -49
  116. data/tests/test_ssl_verify.rb +82 -82
  117. data/tests/test_tick_loop.rb +59 -0
  118. data/tests/test_timers.rb +13 -15
  119. data/tests/test_ud.rb +36 -36
  120. data/tests/testem.rb +31 -31
  121. metadata +66 -51
  122. data/ext/cplusplus.cpp +0 -202
  123. data/ext/emwin.cpp +0 -300
  124. data/ext/emwin.h +0 -94
  125. data/ext/epoll.cpp +0 -26
  126. data/ext/epoll.h +0 -25
  127. data/ext/eventmachine_cpp.h +0 -96
  128. data/ext/files.cpp +0 -94
  129. data/ext/files.h +0 -65
  130. data/ext/sigs.cpp +0 -89
  131. data/ext/sigs.h +0 -32
  132. data/java/src/com/rubyeventmachine/application/Application.java +0 -194
  133. data/java/src/com/rubyeventmachine/application/Connection.java +0 -74
  134. data/java/src/com/rubyeventmachine/application/ConnectionFactory.java +0 -37
  135. data/java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java +0 -46
  136. data/java/src/com/rubyeventmachine/application/PeriodicTimer.java +0 -38
  137. data/java/src/com/rubyeventmachine/application/Timer.java +0 -54
  138. data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +0 -109
  139. data/java/src/com/rubyeventmachine/tests/ConnectTest.java +0 -148
  140. data/java/src/com/rubyeventmachine/tests/EMTest.java +0 -80
  141. data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +0 -53
  142. data/java/src/com/rubyeventmachine/tests/TestServers.java +0 -75
  143. data/java/src/com/rubyeventmachine/tests/TestTimers.java +0 -90
  144. data/lib/evma.rb +0 -32
  145. data/lib/evma/callback.rb +0 -32
  146. data/lib/evma/container.rb +0 -75
  147. data/lib/evma/factory.rb +0 -77
  148. data/lib/evma/protocol.rb +0 -87
  149. data/lib/evma/reactor.rb +0 -48
  150. data/web/whatis +0 -7
@@ -1,13 +1,13 @@
1
- If you have obtained an EventMachine source-tarball (.tar.gz):
2
- unzip and untar the tarball, and enter the directory that is
3
- created. In that directory, say:
4
- ruby setup.rb
5
- (You may need to be root to execute this command.)
6
-
7
- To create documentation for EventMachine, simply type:
8
- rake rdoc
9
- in the distro directory. Rdocs will be created in subdirectory rdoc.
10
-
11
- If you have obtained a gem version of EventMachine, install it in the
12
- usual way (gem install eventmachine). You may need superuser privileges
13
- to execute this command.
1
+ If you have obtained an EventMachine source-tarball (.tar.gz):
2
+ unzip and untar the tarball, and enter the directory that is
3
+ created. In that directory, say:
4
+ ruby setup.rb
5
+ (You may need to be root to execute this command.)
6
+
7
+ To create documentation for EventMachine, simply type:
8
+ rake rdoc
9
+ in the distro directory. Rdocs will be created in subdirectory rdoc.
10
+
11
+ If you have obtained a gem version of EventMachine, install it in the
12
+ usual way (gem install eventmachine). You may need superuser privileges
13
+ to execute this command.
@@ -1,38 +1,42 @@
1
- EventMachine (EM) can respond to keyboard events. This gives your event-driven programs the ability to respond to input from local users.
2
-
3
- Programming EM to handle keyboard input in Ruby is simplicity itself. Just use EventMachine#open_keyboard, and supply the name of a Ruby module or class that will receive the input:
4
-
5
- require 'rubygems'
6
- require 'eventmachine'
7
-
8
- module MyKeyboardHandler
9
- def receive_data keystrokes
10
- puts "I received the following data from the keyboard: #{keystrokes}"
11
- end
12
- end
13
-
14
- EM.run {
15
- EM.open_keyboard(MyKeyboardHandler)
16
- }
17
-
18
-
19
- If you want EM to send line-buffered keyboard input to your program, just include the LineText2 protocol module in your handler class or module:
20
-
21
-
22
-
23
- require 'rubygems'
24
- require 'eventmachine'
25
-
26
- module MyKeyboardHandler
27
- include EM::Protocols::LineText2
28
- def receive_line data
29
- puts "I received the following line from the keyboard: #{data}"
30
- end
31
- end
32
-
33
- EM.run {
34
- EM.open_keyboard(MyKeyboardHandler)
35
- }
36
-
37
- As we said, simplicity itself. You can call EventMachine#open_keyboard at any time while the EM reactor loop is running. In other words, the method invocation may appear anywhere in an EventMachine#run block, or in any code invoked in the #run block.
38
-
1
+ EventMachine (EM) can respond to keyboard events. This gives your event-driven
2
+ programs the ability to respond to input from local users.
3
+
4
+ Programming EM to handle keyboard input in Ruby is simplicity itself. Just use
5
+ EventMachine#open_keyboard, and supply the name of a Ruby module or class that
6
+ will receive the input:
7
+
8
+ require 'rubygems'
9
+ require 'eventmachine'
10
+
11
+ module MyKeyboardHandler
12
+ def receive_data keystrokes
13
+ puts "I received the following data from the keyboard: #{keystrokes}"
14
+ end
15
+ end
16
+
17
+ EM.run {
18
+ EM.open_keyboard(MyKeyboardHandler)
19
+ }
20
+
21
+ If you want EM to send line-buffered keyboard input to your program, just
22
+ include the LineText2 protocol module in your handler class or module:
23
+
24
+ require 'rubygems'
25
+ require 'eventmachine'
26
+
27
+ module MyKeyboardHandler
28
+ include EM::Protocols::LineText2
29
+ def receive_line data
30
+ puts "I received the following line from the keyboard: #{data}"
31
+ end
32
+ end
33
+
34
+ EM.run {
35
+ EM.open_keyboard(MyKeyboardHandler)
36
+ }
37
+
38
+ As we said, simplicity itself. You can call EventMachine#open_keyboard at any
39
+ time while the EM reactor loop is running. In other words, the method
40
+ invocation may appear anywhere in an EventMachine#run block, or in any code
41
+ invoked in the #run block.
42
+
data/docs/LEGAL CHANGED
@@ -1,25 +1,25 @@
1
- LEGAL NOTICE INFORMATION
2
- ------------------------
3
-
4
- EventMachine is Copyright (C) 2006-07 by Francis Cianfrocca.
5
-
6
- EventMachine is copyrighted software owned by Francis Cianfrocca
7
- (blackhedd ... gmail.com). You may redistribute and/or modify this
8
- software as long as you comply with either the terms of the GPL
9
- (see the file GPL), or Ruby's license (see the file COPYING).
10
-
11
- Your use of all the files in this distribution is controlled by these
12
- license terms, except for those files specifically mentioned below:
13
-
14
-
15
-
16
- setup.rb
17
- This file is Copyright (C) 2000-2005 by Minero Aoki
18
- You can distribute/modify this file under the terms of
19
- the GNU LGPL, Lesser General Public License version 2.1.
20
-
21
-
22
- lib/em/buftok.rb
23
- This file is Copyright (C) 2007 by Tony Arcieri. This file is
24
- covered by the terms of Ruby's License (see the file COPYING).
25
-
1
+ LEGAL NOTICE INFORMATION
2
+ ------------------------
3
+
4
+ EventMachine is Copyright (C) 2006-07 by Francis Cianfrocca.
5
+
6
+ EventMachine is copyrighted software owned by Francis Cianfrocca
7
+ (blackhedd ... gmail.com). You may redistribute and/or modify this
8
+ software as long as you comply with either the terms of the GPL
9
+ (see the file GPL), or Ruby's license (see the file COPYING).
10
+
11
+ Your use of all the files in this distribution is controlled by these
12
+ license terms, except for those files specifically mentioned below:
13
+
14
+
15
+
16
+ setup.rb
17
+ This file is Copyright (C) 2000-2005 by Minero Aoki
18
+ You can distribute/modify this file under the terms of
19
+ the GNU LGPL, Lesser General Public License version 2.1.
20
+
21
+
22
+ lib/em/buftok.rb
23
+ This file is Copyright (C) 2007 by Tony Arcieri. This file is
24
+ covered by the terms of Ruby's License (see the file COPYING).
25
+
@@ -1,70 +1,130 @@
1
- EventMachine (EM) adds two different formalisms for lightweight concurrency to the Ruby programmer's toolbox: spawned processes and deferrables. This note will show you how to use them.
2
-
3
-
4
- === What is Lightweight Concurrency?
5
-
6
- We use the term "Lightweight Concurrency" (LC) to refer to concurrency mechanisms that are lighter than Ruby threads. By "lighter," we mean: less resource-intensive in one or more dimensions, usually including memory and CPU usage. In general, you turn to LC in the hope of improving the performance and scalability of your programs.
7
-
8
- In addition to the two EventMachine mechanisms we will discuss here, Ruby has at least one other LC construct: Fibers, which are currently under development in Ruby 1.9.
9
-
10
- The technical feature that makes all of these LC mechanisms different from standard Ruby threads is that they are not scheduled automatically.
11
-
12
- When you create and run Ruby threads, you can assume (within certain constraints) that your threads will all be scheduled fairly by Ruby's runtime. Ruby itself is responsible for giving each of your threads its own share of the total runtime.
13
-
14
- But with LC, your program is responsible for causing different execution paths to run. In effect, your program has to act as a "thread scheduler." Scheduled entities in LC run to completion and are never preempted. The runtime system has far less work to do since it has no need to interrupt threads or to schedule them fairly. This is what makes LC lighter and faster.
15
-
16
- You'll learn exactly how LC scheduling works in practice as we work through specific examples.
17
-
18
-
19
- === EventMachine Lightweight Concurrency
20
-
21
- Recall that EM provides a reactor loop that must be running in order for your programs to perform event-driven logic. An EM program typically has a structure like this:
22
-
23
- require 'eventmachine'
24
-
25
- # your initializations
26
-
27
- EM.run {
28
- # perform event-driven I/O here, including network clients,
29
- # servers, timers, and thread-pool operations.
30
- }
31
-
32
- # your cleanup
33
- # end of the program
34
-
35
-
36
- EventMachine#run executes the reactor loop, which causes your code to be called as events of interest to your program occur. The block you pass to EventMachine#run is executed right after the reactor loop starts, and is the right place to start socket acceptors, etc.
37
-
38
- Because the reactor loop runs constantly in an EM program (until it is stopped by a call to EventMachine#stop), it has the ability to schedule blocks of code for asynchronous execution. Unlike a pre-emptive thread scheduler, it's NOT able to interrupt code blocks while they execute. But the scheduling capability it does have is enough to enable lightweight concurrency.
39
-
40
-
41
- For information on Spawned Processes, see the separate document SPAWNED_PROCESSES.
42
-
43
- For information on Deferrables, see the separate document DEFERRABLES.
44
-
45
-
46
- === [SIDEBAR]: I Heard That EventMachine Doesn't Work With Ruby Threads.
47
-
48
- This is incorrect. EM is fully interoperable with all versions of Ruby threads, and has been since its earliest releases.
49
-
50
- It's very true that EM encourages an "evented" (non-threaded) programming style. The specific benefits of event-driven programming are far better performance and scalabiity for well-written programs, and far easier debugging.
51
-
52
- The benefit of using threads for similar applications is a possibly more intuitive programming model, as well as the fact that threads are already familiar to most programmers. Also, bugs in threaded programs often fail to show up until programs go into production. These factors create the illusion that threaded programs are easier to write.
53
-
54
- However, some operations that occur frequently in professional-caliber applications simply can't be done without threads. (The classic example is making calls to database client-libraries that block on network I/O until they complete.)
55
-
56
- EventMachine not only allows the use of Ruby threads in these cases, but it even provides a built-in thread-pool object to make them easier to work with.
57
-
58
- You may have heard a persistent criticism that evented I/O is fundamentally incompatible with Ruby threads. It is true that some well-publicized attempts to incorporate event-handling libraries into Ruby were not successful. But EventMachine was designed from the ground up with Ruby compatibility in mind, so EM never suffered from the problems that defeated the earlier attempts.
59
-
60
-
61
- === [SIDEBAR]: I Heard That EventMachine Doesn't Work Very Well On Windows.
62
-
63
- This too is incorrect. EventMachine is an extension written in C++ and Java, and therefore it requires compilation. Many Windows computers (and some Unix computers, especially in production environments) don't have a build stack. Attempting to install EventMachine on a machine without a compiler usually produces a confusing error.
64
-
65
- In addition, Ruby has a much-debated issue with Windows compiler versions. Ruby on Windows works best with Visual Studio 6, a compiler version that is long out-of-print, no longer supported by Microsoft, and difficult to obtain. (This problem is not specific to EventMachine.)
66
-
67
- Shortly after EventMachine was first released, the compiler issues led to criticism that EM was incompatible with Windows. Since that time, every EventMachine release has been supplied in a precompiled binary form for Windows users, that does not require you to compile the code yourself. EM binary Gems for Windows are compiled using Visual Studio 6.
68
-
69
- EventMachine does supply some advanced features (such as Linux EPOLL support, reduced-privilege operation, UNIX-domain sockets, etc.) that have no meaningful implementation on Windows. Apart from these special cases, all EM functionality (including lightweight concurrency) works perfectly well on Windows.
70
-
1
+ EventMachine (EM) adds two different formalisms for lightweight concurrency to
2
+ the Ruby programmer's toolbox: spawned processes and deferrables. This note
3
+ will show you how to use them.
4
+
5
+
6
+ === What is Lightweight Concurrency?
7
+
8
+ We use the term "Lightweight Concurrency" (LC) to refer to concurrency
9
+ mechanisms that are lighter than Ruby threads. By "lighter," we mean: less
10
+ resource-intensive in one or more dimensions, usually including memory and
11
+ CPU usage. In general, you turn to LC in the hope of improving the
12
+ performance and scalability of your programs.
13
+
14
+ In addition to the two EventMachine mechanisms we will discuss here, Ruby
15
+ has at least one other LC construct: Fibers, which are currently under
16
+ development in Ruby 1.9.
17
+
18
+ The technical feature that makes all of these LC mechanisms different from
19
+ standard Ruby threads is that they are not scheduled automatically.
20
+
21
+ When you create and run Ruby threads, you can assume (within certain
22
+ constraints) that your threads will all be scheduled fairly by Ruby's runtime.
23
+ Ruby itself is responsible for giving each of your threads its own share of
24
+ the total runtime.
25
+
26
+ But with LC, your program is responsible for causing different execution
27
+ paths to run. In effect, your program has to act as a "thread scheduler."
28
+ Scheduled entities in LC run to completion and are never preempted. The
29
+ runtime system has far less work to do since it has no need to interrupt
30
+ threads or to schedule them fairly. This is what makes LC lighter and faster.
31
+
32
+ You'll learn exactly how LC scheduling works in practice as we work through
33
+ specific examples.
34
+
35
+
36
+ === EventMachine Lightweight Concurrency
37
+
38
+ Recall that EM provides a reactor loop that must be running in order for
39
+ your programs to perform event-driven logic. An EM program typically has a
40
+ structure like this:
41
+
42
+ require 'eventmachine'
43
+
44
+ # your initializations
45
+
46
+ EM.run {
47
+ # perform event-driven I/O here, including network clients,
48
+ # servers, timers, and thread-pool operations.
49
+ }
50
+
51
+ # your cleanup
52
+ # end of the program
53
+
54
+
55
+ EventMachine#run executes the reactor loop, which causes your code to be
56
+ called as events of interest to your program occur. The block you pass to
57
+ EventMachine#run is executed right after the reactor loop starts, and is
58
+ the right place to start socket acceptors, etc.
59
+
60
+ Because the reactor loop runs constantly in an EM program (until it is
61
+ stopped by a call to EventMachine#stop), it has the ability to schedule
62
+ blocks of code for asynchronous execution. Unlike a pre-emptive thread
63
+ scheduler, it's NOT able to interrupt code blocks while they execute. But
64
+ the scheduling capability it does have is enough to enable lightweight
65
+ concurrency.
66
+
67
+
68
+ For information on Spawned Processes, see the separate document
69
+ SPAWNED_PROCESSES.
70
+
71
+ For information on Deferrables, see the separate document DEFERRABLES.
72
+
73
+
74
+ === [SIDEBAR]: I Heard That EventMachine Doesn't Work With Ruby Threads.
75
+
76
+ This is incorrect. EM is fully interoperable with all versions of Ruby
77
+ threads, and has been since its earliest releases.
78
+
79
+ It's very true that EM encourages an "evented" (non-threaded) programming
80
+ style. The specific benefits of event-driven programming are far better
81
+ performance and scalability for well-written programs, and far easier
82
+ debugging.
83
+
84
+ The benefit of using threads for similar applications is a possibly more
85
+ intuitive programming model, as well as the fact that threads are already
86
+ familiar to most programmers. Also, bugs in threaded programs often fail
87
+ to show up until programs go into production. These factors create the
88
+ illusion that threaded programs are easier to write.
89
+
90
+ However, some operations that occur frequently in professional-caliber
91
+ applications simply can't be done without threads. (The classic example
92
+ is making calls to database client-libraries that block on network I/O
93
+ until they complete.)
94
+
95
+ EventMachine not only allows the use of Ruby threads in these cases, but
96
+ it even provides a built-in thread-pool object to make them easier to
97
+ work with.
98
+
99
+ You may have heard a persistent criticism that evented I/O is fundamentally
100
+ incompatible with Ruby threads. It is true that some well-publicized attempts
101
+ to incorporate event-handling libraries into Ruby were not successful. But
102
+ EventMachine was designed from the ground up with Ruby compatibility in mind,
103
+ so EM never suffered from the problems that defeated the earlier attempts.
104
+
105
+
106
+ === [SIDEBAR]: I Heard That EventMachine Doesn't Work Very Well On Windows.
107
+
108
+ This too is incorrect. EventMachine is an extension written in C++ and Java,
109
+ and therefore it requires compilation. Many Windows computers (and some Unix
110
+ computers, especially in production environments) don't have a build stack.
111
+ Attempting to install EventMachine on a machine without a compiler usually
112
+ produces a confusing error.
113
+
114
+ In addition, Ruby has a much-debated issue with Windows compiler versions.
115
+ Ruby on Windows works best with Visual Studio 6, a compiler version that is
116
+ long out-of-print, no longer supported by Microsoft, and difficult to obtain.
117
+ (This problem is not specific to EventMachine.)
118
+
119
+ Shortly after EventMachine was first released, the compiler issues led to
120
+ criticism that EM was incompatible with Windows. Since that time, every
121
+ EventMachine release has been supplied in a precompiled binary form for
122
+ Windows users, that does not require you to compile the code yourself. EM
123
+ binary Gems for Windows are compiled using Visual Studio 6.
124
+
125
+ EventMachine does supply some advanced features (such as Linux EPOLL support,
126
+ reduced-privilege operation, UNIX-domain sockets, etc.) that have no
127
+ meaningful implementation on Windows. Apart from these special cases, all EM
128
+ functionality (including lightweight concurrency) works perfectly well on
129
+ Windows.
130
+
@@ -1,75 +1,75 @@
1
- EventMachine is supplied in three alternative versions.
2
-
3
- 1) A version that includes a Ruby extension written in C++. This version requires compilation;
4
- 2) A version for JRuby that contains a precompiled JAR file written in Java;
5
- 3) A pure Ruby version that has no external dependencies and can run in any Ruby environment.
6
-
7
- The Java version of EventMachine is packaged in a distinct manner and must be installed using a
8
- special procedure. This version is described fully in a different document, and not considered
9
- further here.
10
-
11
- The C++ and pure-Ruby versions, however, are shipped in the same distribution. You use the same
12
- files (either tarball or Ruby gem) to install both of these versions.
13
-
14
- If you intend to use the C++ version, you must successfully compile EventMachine after you install it.
15
- (The gem installation attempts to perform this step automatically.)
16
-
17
- If you choose not to compile the EventMachine C++ extension, or if your compilation fails for any
18
- reason, you still have a fully-functional installation of the pure-Ruby version of EM.
19
-
20
- However, for technical reasons, a default EM installation (whether or not the compilation succeeds)
21
- will always assume that the compiled ("extension") implementation should be used.
22
-
23
- If you want your EM program to use the pure Ruby version, you must specifically request it. There
24
- are two ways to do this: by setting either a Ruby global variable, or an environment string.
25
-
26
- The following code will invoke the pure-Ruby implementation of EM:
27
-
28
- $eventmachine_library = :pure_ruby
29
- require 'eventmachine'
30
-
31
- EM.library_type #=> "pure_ruby"
32
-
33
- Notice that this requires a code change and is not the preferred way to select pure Ruby, unless
34
- for some reason you are absolutely sure you will never want the compiled implementation.
35
-
36
- Setting the following environment string has the same effect:
37
-
38
- export EVENTMACHINE_LIBRARY="pure_ruby"
39
-
40
- This technique gives you the flexibility to select either version at runtime with no code changes.
41
-
42
- Support
43
-
44
- The EventMachine development team has committed to support precisely the same APIs for all the
45
- various implementations of EM.
46
-
47
- This means that you can expect any EM program to behave identically, whether you use pure Ruby,
48
- the compiled C++ extension, or JRuby. Deviations from this behavior are to be considered bugs
49
- and should be reported as such.
50
-
51
- There is a small number of exceptions to this rule, which arise from underlying platform
52
- distinctions. Notably, EM#epoll is a silent no-op in the pure Ruby implementation.
53
-
54
-
55
- When Should You Use the Pure-Ruby Implementation of EM?
56
-
57
-
58
- Use the pure Ruby implementation of EM when you must support a platform for which no C++ compiler
59
- is available, or on which the standard EM C++ code can't be compiled.
60
-
61
- Keep in mind that you don't need a C++ compiler in order to deploy EM applications that rely on
62
- the compiled version, so long as appropriate C++ runtime libraries are available on the target platform.
63
-
64
- In extreme cases, you may find that you can develop software with the compiled EM version, but are
65
- not allowed to install required runtime libraries on the deployment system(s). This would be another
66
- case in which the pure Ruby implementation can be useful.
67
-
68
- In general you should avoid the pure Ruby version of EM when performance and scalability are important.
69
- EM in pure Ruby will necessarily run slower than the compiled version. Depending on your application
70
- this may or may not be a key issue.
71
-
72
- Also, since EPOLL is not supported in pure Ruby, your applications will be affected by Ruby's built-in
73
- limit of 1024 file and socket descriptors that may be open in a single process. For maximum scalability
74
- and performance, always use EPOLL if possible.
75
-
1
+ EventMachine is supplied in three alternative versions.
2
+
3
+ 1) A version that includes a Ruby extension written in C++. This version requires compilation;
4
+ 2) A version for JRuby that contains a precompiled JAR file written in Java;
5
+ 3) A pure Ruby version that has no external dependencies and can run in any Ruby environment.
6
+
7
+ The Java version of EventMachine is packaged in a distinct manner and must be installed using a
8
+ special procedure. This version is described fully in a different document, and not considered
9
+ further here.
10
+
11
+ The C++ and pure-Ruby versions, however, are shipped in the same distribution. You use the same
12
+ files (either tarball or Ruby gem) to install both of these versions.
13
+
14
+ If you intend to use the C++ version, you must successfully compile EventMachine after you install it.
15
+ (The gem installation attempts to perform this step automatically.)
16
+
17
+ If you choose not to compile the EventMachine C++ extension, or if your compilation fails for any
18
+ reason, you still have a fully-functional installation of the pure-Ruby version of EM.
19
+
20
+ However, for technical reasons, a default EM installation (whether or not the compilation succeeds)
21
+ will always assume that the compiled ("extension") implementation should be used.
22
+
23
+ If you want your EM program to use the pure Ruby version, you must specifically request it. There
24
+ are two ways to do this: by setting either a Ruby global variable, or an environment string.
25
+
26
+ The following code will invoke the pure-Ruby implementation of EM:
27
+
28
+ $eventmachine_library = :pure_ruby
29
+ require 'eventmachine'
30
+
31
+ EM.library_type #=> "pure_ruby"
32
+
33
+ Notice that this requires a code change and is not the preferred way to select pure Ruby, unless
34
+ for some reason you are absolutely sure you will never want the compiled implementation.
35
+
36
+ Setting the following environment string has the same effect:
37
+
38
+ export EVENTMACHINE_LIBRARY="pure_ruby"
39
+
40
+ This technique gives you the flexibility to select either version at runtime with no code changes.
41
+
42
+ Support
43
+
44
+ The EventMachine development team has committed to support precisely the same APIs for all the
45
+ various implementations of EM.
46
+
47
+ This means that you can expect any EM program to behave identically, whether you use pure Ruby,
48
+ the compiled C++ extension, or JRuby. Deviations from this behavior are to be considered bugs
49
+ and should be reported as such.
50
+
51
+ There is a small number of exceptions to this rule, which arise from underlying platform
52
+ distinctions. Notably, EM#epoll is a silent no-op in the pure Ruby implementation.
53
+
54
+
55
+ When Should You Use the Pure-Ruby Implementation of EM?
56
+
57
+
58
+ Use the pure Ruby implementation of EM when you must support a platform for which no C++ compiler
59
+ is available, or on which the standard EM C++ code can't be compiled.
60
+
61
+ Keep in mind that you don't need a C++ compiler in order to deploy EM applications that rely on
62
+ the compiled version, so long as appropriate C++ runtime libraries are available on the target platform.
63
+
64
+ In extreme cases, you may find that you can develop software with the compiled EM version, but are
65
+ not allowed to install required runtime libraries on the deployment system(s). This would be another
66
+ case in which the pure Ruby implementation can be useful.
67
+
68
+ In general you should avoid the pure Ruby version of EM when performance and scalability are important.
69
+ EM in pure Ruby will necessarily run slower than the compiled version. Depending on your application
70
+ this may or may not be a key issue.
71
+
72
+ Also, since EPOLL is not supported in pure Ruby, your applications will be affected by Ruby's built-in
73
+ limit of 1024 file and socket descriptors that may be open in a single process. For maximum scalability
74
+ and performance, always use EPOLL if possible.
75
+