Revert, this is causing threading issues with Windows.

git-svn-id: file:///home/svn/framework3/trunk@10989 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-11-11 19:54:27 +00:00
parent a758dfe37d
commit 8afc9ebb41
1 changed files with 10 additions and 17 deletions

View File

@ -28,18 +28,6 @@ class PacketResponseWaiter
self.completion_param = completion_param self.completion_param = completion_param
else else
self.done = false self.done = false
self.wthread = initialize_waiter_thread
end
end
#
# Create an idle thread we can wait on
#
def initialize_waiter_thread
::Thread.new do
while (! self.done)
::IO.select(nil,nil,nil,5.0)
end
end end
end end
@ -61,7 +49,6 @@ class PacketResponseWaiter
self.completion_routine.call(response, self.completion_param) self.completion_routine.call(response, self.completion_param)
else else
self.done = true self.done = true
self.wthread.kill
end end
end end
@ -71,10 +58,16 @@ class PacketResponseWaiter
# #
def wait(interval) def wait(interval)
if( interval and interval == -1 ) if( interval and interval == -1 )
self.wthread.join while(not self.done)
::IO.select(nil, nil, nil, 0.1)
end
else else
begin begin
Timeout.timeout(interval) { self.wthread.join } Timeout.timeout(interval) {
while(not self.done)
::IO.select(nil, nil, nil, 0.1)
end
}
rescue Timeout::Error rescue Timeout::Error
self.response = nil self.response = nil
end end
@ -82,7 +75,7 @@ class PacketResponseWaiter
return self.response return self.response
end end
attr_accessor :rid, :done, :response, :wthread # :nodoc: attr_accessor :rid, :done, :response # :nodoc:
attr_accessor :completion_routine, :completion_param # :nodoc: attr_accessor :completion_routine, :completion_param # :nodoc:
end end