From 3c26e6e066af551119eea89c4a16952eecc2b466 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 31 May 2010 22:35:32 -0400 Subject: [PATCH] Put a lock around adding to the write queue in |-send|. --- Source/DebuggerConnection.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index 73e5b27..760ca7e 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -456,10 +456,13 @@ void SocketAcceptCallback(CFSocketRef socket, */ - (void)send:(NSString*)command { - if (lastReadTransaction_ >= lastWrittenTransaction_ && CFWriteStreamCanAcceptBytes(writeStream_)) + if (lastReadTransaction_ >= lastWrittenTransaction_ && CFWriteStreamCanAcceptBytes(writeStream_)) { [self performSend:command]; - else + } else { + [writeQueueLock_ lock]; [queuedWrites_ addObject:command]; + [writeQueueLock_ unlock]; + } [self sendQueuedWrites]; } -- 2.43.5