minor: pool test working for windows on 1.8.6

This commit is contained in:
Kyle Banker 2009-12-29 13:27:12 -05:00
parent e013618a8f
commit 7a08e2c84f
1 changed files with 11 additions and 4 deletions

View File

@ -109,6 +109,7 @@ module Mongo
# Mutex for synchronizing pool access
@connection_mutex = Mutex.new
@safe_mutex = Mutex.new
# Condition variable for signal and wait
@queue = ConditionVariable.new
@ -218,8 +219,11 @@ module Mongo
@logger.debug(" MONGODB #{log_message || message}") if @logger
sock = checkout
packed_message = message_with_headers.append!(message_with_check).to_s
docs = num_received = cursor_id = ''
@safe_mutex.synchronize do
send_message_on_socket(packed_message, sock)
docs, num_received, cursor_id = receive(sock)
end
checkin(sock)
if num_received == 1 && error = docs[0]['err']
raise Mongo::OperationFailure, error
@ -237,8 +241,11 @@ module Mongo
@logger.debug(" MONGODB #{log_message || message}") if @logger
sock = socket || checkout
result = ''
@safe_mutex.synchronize do
send_message_on_socket(packed_message, sock)
result = receive(sock)
end
checkin(sock)
result
end