File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,14 @@ def waiting_for?(packet)
44
44
# Notifies the waiter that the supplied response packet has arrived.
45
45
#
46
46
def notify ( response )
47
- self . response = response
48
-
49
47
if ( self . completion_routine )
48
+ self . response = response
50
49
self . completion_routine . call ( response , self . completion_param )
51
50
else
52
- self . mutex . synchronize {
51
+ self . mutex . synchronize do
52
+ self . response = response
53
53
self . cond . signal
54
- }
54
+ end
55
55
end
56
56
end
57
57
@@ -61,9 +61,11 @@ def notify(response)
61
61
#
62
62
def wait ( interval )
63
63
interval = nil if interval and interval == -1
64
- self . mutex . synchronize {
65
- self . cond . wait ( self . mutex , interval )
66
- }
64
+ self . mutex . synchronize do
65
+ if self . response . nil?
66
+ self . cond . wait ( self . mutex , interval )
67
+ end
68
+ end
67
69
return self . response
68
70
end
69
71
You can’t perform that action at this time.
0 commit comments