minor: pool test working for windows on 1.8.6
This commit is contained in:
parent
e013618a8f
commit
7a08e2c84f
|
@ -109,6 +109,7 @@ module Mongo
|
||||||
|
|
||||||
# Mutex for synchronizing pool access
|
# Mutex for synchronizing pool access
|
||||||
@connection_mutex = Mutex.new
|
@connection_mutex = Mutex.new
|
||||||
|
@safe_mutex = Mutex.new
|
||||||
|
|
||||||
# Condition variable for signal and wait
|
# Condition variable for signal and wait
|
||||||
@queue = ConditionVariable.new
|
@queue = ConditionVariable.new
|
||||||
|
@ -218,8 +219,11 @@ module Mongo
|
||||||
@logger.debug(" MONGODB #{log_message || message}") if @logger
|
@logger.debug(" MONGODB #{log_message || message}") if @logger
|
||||||
sock = checkout
|
sock = checkout
|
||||||
packed_message = message_with_headers.append!(message_with_check).to_s
|
packed_message = message_with_headers.append!(message_with_check).to_s
|
||||||
send_message_on_socket(packed_message, sock)
|
docs = num_received = cursor_id = ''
|
||||||
docs, num_received, cursor_id = receive(sock)
|
@safe_mutex.synchronize do
|
||||||
|
send_message_on_socket(packed_message, sock)
|
||||||
|
docs, num_received, cursor_id = receive(sock)
|
||||||
|
end
|
||||||
checkin(sock)
|
checkin(sock)
|
||||||
if num_received == 1 && error = docs[0]['err']
|
if num_received == 1 && error = docs[0]['err']
|
||||||
raise Mongo::OperationFailure, error
|
raise Mongo::OperationFailure, error
|
||||||
|
@ -237,8 +241,11 @@ module Mongo
|
||||||
@logger.debug(" MONGODB #{log_message || message}") if @logger
|
@logger.debug(" MONGODB #{log_message || message}") if @logger
|
||||||
sock = socket || checkout
|
sock = socket || checkout
|
||||||
|
|
||||||
send_message_on_socket(packed_message, sock)
|
result = ''
|
||||||
result = receive(sock)
|
@safe_mutex.synchronize do
|
||||||
|
send_message_on_socket(packed_message, sock)
|
||||||
|
result = receive(sock)
|
||||||
|
end
|
||||||
checkin(sock)
|
checkin(sock)
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue