func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
// It's OK to use pattern in tests.
func(^{
dispatch_semaphore_signal(sema1);
});
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
dispatch_semaphore_t sema2 = dispatch_semaphore_create(0);
func(^{
dispatch_semaphore_signal(sema2);
});
- dispatch_semaphore_wait(sema2, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema2, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void use_semaphor_antipattern_multiple_wait() {
dispatch_semaphore_signal(sema1);
});
// FIXME: multiple waits on same semaphor should not raise a warning.
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void warn_incorrect_order() {
// if out of order.
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
func(^{
dispatch_semaphore_signal(sema);
});
func_w_typedef(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void warn_nested_ast() {
dispatch_semaphore_signal(sema);
});
}
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void use_semaphore_assignment() {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void use_semaphore_assignment_init() {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void differentsemaphoreok() {
func(^{
dispatch_semaphore_signal((int)sema);
});
- dispatch_semaphore_wait((int)sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait((int)sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
@interface MyInterface1 : NSObject
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
}
-(void) pass_block_as_second_param_warn {
[self flag:1 acceptBlock:^{
dispatch_semaphore_signal(sema);
}];
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
}
-(void)testNoWarn {
[self acceptBlock:^{
dispatch_semaphore_signal(sema);
}];
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
}
-(void)use_dispatch_group {
[self acceptBlock:^{
dispatch_group_leave(group);
}];
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
}
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
dispatch_semaphore_t sema1 = dispatch_semaphore_create(0);
[t acceptBlock:^{
dispatch_semaphore_signal(sema1);
}];
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback}}
}
@end
func(^{
dispatch_group_leave(group);
});
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
}
[M acceptBlock:^{
dispatch_group_leave(group);
}];
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
}
void dispatch_group_and_semaphore_use(MyInterface1 *M) {
[M acceptBlock:^{
dispatch_group_leave(group);
}];
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
dispatch_semaphore_t sema1 = dispatch_semaphore_create(0);
[M acceptBlock:^{
dispatch_semaphore_signal(sema1);
}];
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}