本月博客排行
-
第1名
Xeden -
第2名
fantaxy025025 -
第3名
bosschen - paulwong
- johnsmith9th
- zysnba
- xiangjie88
年度博客排行
-
第1名
青否云后端云 -
第2名
宏天软件 -
第3名
gashero - gengyun12
- wy_19921005
- vipbooks
- e_e
- benladeng5225
- ranbuijj
- wallimn
- javashop
- jickcai
- fantaxy025025
- zw7534313
- qepwqnp
- robotmen
- 解宜然
- ssydxa219
- zysnba
- sam123456gz
- sichunli_030
- tanling8334
- arpenker
- gaojingsong
- xpenxpen
- kaizi1992
- wiseboyloves
- jh108020
- xyuma
- ganxueyun
- wangchen.ily
- xiangjie88
- Jameslyy
- luxurioust
- mengjichen
- lemonhandsome
- jbosscn
- nychen2000
- zxq_2017
- lzyfn123
- wjianwei666
- forestqqqq
- ajinn
- siemens800
- hanbaohong
- 狂盗一枝梅
- java-007
- zhanjia
- 喧嚣求静
- Xeden
最新文章列表
Fiber和Ruby 实现管道式过滤器
# Fiber和Ruby的功能展示的淋漓尽致。大致解说下,PipelineElement作为任何一个过滤器的父类,其中封装了一个fiber,# 这个fiber默认执行process,在process方 ...
(翻译)Untangling Evented Code with Ruby Fibers
Untangling Evented Code with Ruby FibersBy Ilya Grigorik on March 22, 2010Event-driven programming requires a mind-shift in how you architect the program, and oftentimes directly affects the c ...
eventmachine 实例
require 'eventmachine'require 'em-http'require 'fiber'EventMachine.run do page = EventMachine::HttpRequest.new('http://michael-roshen.iteye.com/').get page.errback{p "baidu is down! terminate?&q ...
Fiber-参数传递
Fiber-参数传递
当一个fiber创建后不会立即执行,除非调用Fiber#resume方法,Fiber.yield放弃控制权给调用者,这里的调用者是Fiber#resume的调用者,就是主程序
fiber = Fiber.new do Fiber.yield 1 2endputs fiber.resumeputs fiber.resumeputs fiber.resum ...
一小段代码理解Fiber
server = Fiber.new do |request|
puts 'Server Started'
while(request != 'exit')
puts "Received request: #{request}"
request = Fiber.yield Random.rand
end
end
response = ...