Class: CRuby::TimerChannel
- Includes:
- IOT
- Defined in:
- lib/cruby/channel.rb
Instance Method Summary collapse
-
#sendEvt(msg) ⇒ Object
送信イベントを生成する.
- #timeout ⇒ Object
Methods included from IOT
Methods inherited from Channel
#initialize, #recv, #recvEvt, #send
Constructor Details
This class inherits a constructor from CRuby::Channel
Instance Method Details
#sendEvt(msg) ⇒ Object
送信イベントを生成する
167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/cruby/channel.rb', line 167 def sendEvt msg pollFn = Proc.new { false } blockFn = Proc.new {|flg,k| if flg[0] == true then CRuby::Coroutine.dispatch end @@timerQ <<= {:time=>Time.now+msg,:chan=>self} @@timerQ.sort! {|a,b| a[:time]<=>b[:time]} @sendQ.enqueue({'flg'=>flg,'msg'=>msg,'cont'=>k}) } CRuby::Event.new([CRuby::Event::BEvt.new(pollFn, nil, blockFn)]) end |