I am struggling with a deadlock in my GCD code. Then I saw this function dispatch_debug in the header file <dispatch/object.h>.
/*!
* @function dispatch_debug
*
* @abstract
* Programmatically log debug information about a dispatch object.
*
* @param object
* The object to introspect.
*
* @param message
* The message to log above and beyond the introspection.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW __attribute__((__format__(printf,2,3)))
void
dispatch_debug(dispatch_object_t object, const char *message, ...);
But I am not able to make it do anything. I was hoping it would print out the state and locks or something like that.
Here is how I use it:
grabber_queue = dispatch_queue_create("com.unpaq.tvguideplus.grabber", NULL);
dispatch_debug(grabber_queue, "grabber queue");
dispatch_debug sends messages to syslog. So,
this code would print as the following in system.log.
It doesn’t appear in Xcode debug console. You can see in /Applications/Utilities/Console.app system.log on the iPhone simulator, or in Xcode organizer on iPhone, iPod touch and iPad.
By the way, GCD is open source. It is distributed via libdispatch. dispatch_debug is included in src/object.c.