[libdispatch-dev] dispatch_once_t must have global or static scope?

Michael Ash michael.ash at gmail.com
Thu Jul 26 10:14:58 PDT 2012

The GCD reference on developer.apple.com says, regarding dispatch_once_t:

"Variables of this type must have global or static scope. The result of using this type with automatic or dynamic allocation is undefined."


However, I can't find any explanation of why that would be the case, either in the documentation or the libdispatch code. Does anyone have any insight to shed on this? It's occasionally useful to have a dispatch_once_t member variable in an Objective-C object, and it would be nice to know if that's actually OK or not. I have a hard time figuring out how GCD could possibly care about the storage scope of the variable, but it's possible that I'm overlooking something.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-dev/attachments/20120726/a26cd1a3/attachment.html>

More information about the libdispatch-dev mailing list