0
How does dispatch_once manages to run only once?

Open 1 Answers 25 Views Technology

How does dispatch_once manages to run only once?

1 Answer

0
dispatch_once() is synchronous process and all GCD methods do things asynchronously (case in point, dispatch_sync() is synchronous)
The entire idea of dispatch_once() is “perform something once and only once”, which is precisely what we’re doing. dispatch_once that’s used to guarantee that something happens exactly once, no matter how violent the program’s threading becomes.
by (249k points)
...