A
Ashikali Ashikali
Hi all ,
I am using following gems .
gem1.8 list
*** LOCAL GEMS ***
actionmailer (2.3.2)
actionpack (2.3.2)
activesupport (2.3.2)
ruby-ole (1.2.8.2)
ruby-serialport (0.7.0)
spreadsheet (0.6.3.1)
xml-simple (1.0.12)
I am using modem . By using the serialport I am accessing the modem
port .
while using the <modemobject>.sysread or read get blocked although I
set <modemobject>.read_timeout = -1
But in fork it is working properly .
log is ,irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'serialport'
=> true
irb(main):003:0> sp = SerialPort.new( "/dev/ttyPS1" , 115200 )
=> #<SerialPort:0xb796b074>
irb(main):004:0> sp.read_timout
NoMethodError: undefined method `read_timout' for
#<SerialPort:0xb796b074>
from (irb):4
irb(main):005:0> sp.read_timeout
=> 0
irb(main):006:0> sp.read_timeout = -1
=> -1
irb(main):007:0> sp.sysread 45
EOFError: end of file reached
from (irb):7:in `sysread'
from (irb):7
irb(main):008:0> sp.sysread 45
EOFError: end of file reached
from (irb):8:in `sysread'
from (irb):8
irb(main):009:0> sp.sysread 45
EOFError: end of file reached
from (irb):9:in `sysread'
from (irb):9
irb(main):010:0> sp.sysread 45
EOFError: end of file reached
from (irb):10:in `sysread'
from (irb):10
irb(main):011:0> sp.sysread 45
EOFError: end of file reached
from (irb):11:in `sysread'
from (irb):11
irb(main):012:0> fork {
irb(main):013:1* sp.sysread 45
irb(main):014:1> }
(irb):13:in `sysread': end of file reached (EOFError)
from (irb):13:in `irb_binding'
from (irb):12:in `fork'
from (irb):12:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52
=> 9425
irb(main):015:0> Thread.new(sp){ |sp|
irb(main):016:1* sp.sysread 43
irb(main):017:1> }
=> #<Thread:0xb7955620 sleep>
irb(main):018:0> Thread.new(sp){ |sp|
irb(main):019:1* p "before"
irb(main):020:1> sp.sysread 43
irb(main):021:1> p "asdf"
irb(main):022:1> }
"before"=> #<Thread:0xb794e8d4 run>
< blocked>
Can any one help me to resolve this?
cheers ,
ashikali
I am using following gems .
gem1.8 list
*** LOCAL GEMS ***
actionmailer (2.3.2)
actionpack (2.3.2)
activesupport (2.3.2)
ruby-ole (1.2.8.2)
ruby-serialport (0.7.0)
spreadsheet (0.6.3.1)
xml-simple (1.0.12)
I am using modem . By using the serialport I am accessing the modem
port .
while using the <modemobject>.sysread or read get blocked although I
set <modemobject>.read_timeout = -1
But in fork it is working properly .
log is ,irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'serialport'
=> true
irb(main):003:0> sp = SerialPort.new( "/dev/ttyPS1" , 115200 )
=> #<SerialPort:0xb796b074>
irb(main):004:0> sp.read_timout
NoMethodError: undefined method `read_timout' for
#<SerialPort:0xb796b074>
from (irb):4
irb(main):005:0> sp.read_timeout
=> 0
irb(main):006:0> sp.read_timeout = -1
=> -1
irb(main):007:0> sp.sysread 45
EOFError: end of file reached
from (irb):7:in `sysread'
from (irb):7
irb(main):008:0> sp.sysread 45
EOFError: end of file reached
from (irb):8:in `sysread'
from (irb):8
irb(main):009:0> sp.sysread 45
EOFError: end of file reached
from (irb):9:in `sysread'
from (irb):9
irb(main):010:0> sp.sysread 45
EOFError: end of file reached
from (irb):10:in `sysread'
from (irb):10
irb(main):011:0> sp.sysread 45
EOFError: end of file reached
from (irb):11:in `sysread'
from (irb):11
irb(main):012:0> fork {
irb(main):013:1* sp.sysread 45
irb(main):014:1> }
(irb):13:in `sysread': end of file reached (EOFError)
from (irb):13:in `irb_binding'
from (irb):12:in `fork'
from (irb):12:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52
=> 9425
irb(main):015:0> Thread.new(sp){ |sp|
irb(main):016:1* sp.sysread 43
irb(main):017:1> }
=> #<Thread:0xb7955620 sleep>
irb(main):018:0> Thread.new(sp){ |sp|
irb(main):019:1* p "before"
irb(main):020:1> sp.sysread 43
irb(main):021:1> p "asdf"
irb(main):022:1> }
"before"=> #<Thread:0xb794e8d4 run>
< blocked>
Can any one help me to resolve this?
cheers ,
ashikali