Skip to content

Instantly share code, notes, and snippets.

@pita5
Created September 5, 2013 09:33
Show Gist options
  • Save pita5/6448009 to your computer and use it in GitHub Desktop.
Save pita5/6448009 to your computer and use it in GitHub Desktop.
- (void)testWeakAssign
{
SingleThreadLock* condition = [[SingleThreadLock alloc]init];
__block AXProductDescription *p1;
[AXProductDescription getHeroesWithCompletionHandler:^(NSArray *products, NSError *error) {
p1 = [products objectAtIndex:0];
[condition signal];
}];
STAssertTrue([condition waitWithTimeout:200], @"Timeout");
@autoreleasepool
{
condition = [[SingleThreadLock alloc] init];
[p1 getProductWithCompletionHandler:^(AXProduct *p2, NSError *error) {
[condition signal];
}];
STAssertTrue([condition waitWithTimeout:200], @"Timeout");
}
@autoreleasepool
{
condition = [[SingleThreadLock alloc]init];
[p1 getProductWithCompletionHandler:^(AXProduct *p2, NSError *error) {
[condition signal];
}];
STAssertTrue([condition waitWithTimeout:200], @"Timeout");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment