-
Notifications
You must be signed in to change notification settings - Fork 20
Group
aleclarson edited this page Oct 21, 2014
·
1 revision
A Group
watches two or more concurrent tasks.
If all tasks complete, the closure you pass to done()
is called.
If any task fails to complete in x
seconds, the closure you pass to wait()
is called.
let group = Group(1)
gcd.async {
// do some work...
--group
}
if someCondition {
++group
gcd.async {
// do some other work...
--group
}
}
group.done {
// do something when both are finished...
}
group.wait(1) {
// do something if the group isn't done in 1 second...
}