From 49b7f8349be4c5ca9d180133d35e57f912f0a373 Mon Sep 17 00:00:00 2001
From: Muxi Yan <mxyan@google.com>
Date: Mon, 22 May 2017 10:39:48 -0700
Subject: [PATCH] Remove synchronization in
 GRXBufferedPipe:writesFinishedWithError and change tests correspondingly

---
 src/objective-c/RxLibrary/GRXBufferedPipe.m | 5 -----
 src/objective-c/tests/RxLibraryUnitTests.m  | 4 ++++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/objective-c/RxLibrary/GRXBufferedPipe.m b/src/objective-c/RxLibrary/GRXBufferedPipe.m
index 9dfe332eef..bffabc53f2 100644
--- a/src/objective-c/RxLibrary/GRXBufferedPipe.m
+++ b/src/objective-c/RxLibrary/GRXBufferedPipe.m
@@ -82,11 +82,6 @@
   if (errorOrNil) {
     // No need to write pending values.
     [self finishWithError:_errorOrNil];
-  } else {
-    // Wait until all the pending writes to be finished.
-    dispatch_sync(_writeQueue, ^{
-      return;
-    });
   }
 }
 
diff --git a/src/objective-c/tests/RxLibraryUnitTests.m b/src/objective-c/tests/RxLibraryUnitTests.m
index feade14eea..e2ff6e4598 100644
--- a/src/objective-c/tests/RxLibraryUnitTests.m
+++ b/src/objective-c/tests/RxLibraryUnitTests.m
@@ -166,6 +166,9 @@
   [pipe writeValue:anyValue];
   [pipe writesFinishedWithError:nil];
 
+  // Wait buffered pipe to be flushed.
+  sleep(1);
+
   // Then:
   XCTAssertEqual(handler.timesCalled, 1);
   XCTAssertEqualObjects(handler.value, anyValue);
@@ -202,6 +205,7 @@
   [pipe writesFinishedWithError:nil];
   // then start the writeable
   [pipe startWithWriteable:writeable];
+  sleep(1);
 
   // Then:
   XCTAssertEqual(handler.timesCalled, 1);
-- 
GitLab