From 31cd9beee55a4ff24683cc2c92e9aa8525bcc236 Mon Sep 17 00:00:00 2001 From: Murat Baysangurov Date: Wed, 2 Aug 2017 13:11:24 +0300 Subject: [PATCH] Semaphore replaced with expectation --- Support/HockeySDKTests/BITHockeyHelperTests.m | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Support/HockeySDKTests/BITHockeyHelperTests.m b/Support/HockeySDKTests/BITHockeyHelperTests.m index 744377319b..9b05407494 100644 --- a/Support/HockeySDKTests/BITHockeyHelperTests.m +++ b/Support/HockeySDKTests/BITHockeyHelperTests.m @@ -308,7 +308,7 @@ - (BOOL)excludeAttributeIsSetForURL:(NSURL *)directoryURL { __block BOOL result = NO; - dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + XCTestExpectation *expectation = [self expectationWithDescription:@"wait"]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSError *getResourceError = nil; NSNumber *appSupportDirExcludedValue; @@ -317,12 +317,9 @@ result = YES; } } - dispatch_semaphore_signal(semaphore); + [expectation fulfill]; }); - while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW)){ - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode - beforeDate:[NSDate dateWithTimeIntervalSinceNow:10]]; - } + [self waitForExpectationsWithTimeout:5 handler:nil]; return result; }