Changeset 507
- Timestamp:
- 08/17/07 05:45:20 (1 year ago)
- Files:
-
- version_0/ChangeLog (modified) (1 diff)
- version_0/lib/eventmachine.rb (modified) (1 diff)
- version_0/tests/test_basic.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
version_0/ChangeLog
r506 r507 58 58 15Aug07: Added parameters for EventMachine::Connection:start_tls that can be 59 59 used to specify client-side private keys and certificates. 60 17Aug07: Added EventMachine#run_block, a sugaring for a common use case. 60 61 version_0/lib/eventmachine.rb
r502 r507 228 228 229 229 230 # Sugars a common use case. Will pass the given block to #run, but will terminate 231 # the reactor loop and exit the function as soon as the code in the block completes. 232 # (Normally, #run keeps running indefinitely, even after the block supplied to it 233 # finishes running, until user code calls #stop.) 234 # 235 def EventMachine::run_block &block 236 pr = proc { 237 block.call 238 EventMachine::stop 239 } 240 run &pr 241 end 242 243 230 244 # +deprecated+ 231 245 #-- version_0/tests/test_basic.rb
r459 r507 94 94 #-------------------------------------- 95 95 96 # EventMachine#run_block starts the reactor loop, runs the supplied block, and then STOPS 97 # the loop automatically. Contrast with EventMachine#run, which keeps running the reactor 98 # even after the supplied block completes. 99 def test_run_block 100 a = nil 101 EM.run_block { a = "Worked" } 102 assert a 103 end 104 105 106 #-------------------------------------- 107 96 108 end 97 109
