Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation discussion: why to use dispatch_group_async along with dispatch_group_enter/leave? #13

Closed
Josscii opened this issue Feb 4, 2018 · 2 comments

Comments

@Josscii
Copy link

Josscii commented Feb 4, 2018

I dug into the source, and found that you use dispatch_group_async along with dispatch_group_enter/leave, is this the right way to use GCD group?

image

I googled it and find an blog explaining the concept: Using dispatch groups to wait for multiple web services, it says use either dispatch_group_async OR dispatch_group_enter/leave.

Anyone can explain it?

If it is not appropriate to ask there, sorry for that, I will close it.

@shoumikhin
Copy link
Contributor

Thank you for digging into the code, Josscii!
We're always happy to clarify any non-trivial aspects.

The docs mention that dispatch_group_async is just a convenience wrapper for dispatch_group_enter/leave, so the two are not mutually exclusive.

We use dispatch groups primarily to facilitate testing with FBLWaitForPromisesWithTimeout.

Hope that helps.

@Josscii
Copy link
Author

Josscii commented Feb 4, 2018

Thanks for your information.

It seems that I didn't understand your intention to use dipatch_group, sorry for the stupid question.

Now it becomes more clear, I will read your code and learn more from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants