aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMNSThread+BlocksTest.m9
1 files changed, 4 insertions, 5 deletions
diff --git a/Foundation/GTMNSThread+BlocksTest.m b/Foundation/GTMNSThread+BlocksTest.m
index e051de9..1b13ebf 100644
--- a/Foundation/GTMNSThread+BlocksTest.m
+++ b/Foundation/GTMNSThread+BlocksTest.m
@@ -223,12 +223,12 @@ static const int kThreadMethoduSleep = 10000;
}
- (void)testCancelFromOtherThread {
- // Show that cancel actually cancels before all blocks are executed.
- __block int counter = 0;
+ // Cancel will kill the thread at same point.
+ // It may or may not complete all the blocks.
+ // There is no guarantee made (unlike stop).
for (int i = 0; i < kThreadMethodCounter; i++) {
[workerThread_ gtm_performWaitingUntilDone:NO block:^{
- sleep(1);
- ++counter;
+ usleep(kThreadMethoduSleep);
}];
}
[workerThread_ cancel];
@@ -242,7 +242,6 @@ static const int kThreadMethoduSleep = 10000;
handler:NULL];
[self waitForExpectationsWithTimeout:kTestTimeout handler:NULL];
XCTAssertTrue([workerThread_ isFinished]);
- XCTAssertNotEqual(counter, kThreadMethodCounter);
}
- (void)testStopFromThread {