应该如何使用dispatch_debug? [英] How is dispatch_debug supposed to be used?
问题描述
< dispatch / object.h>
中看到这个函数 dispatch_debug
。 b $ b
/ *!
* @function dispatch_debug
*
* @abstract
*以编程方式记录调度对象的调试信息。
*
* @param对象
*内省对象。
*
* @param message
*要注册的消息超出内省。
* /
__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,...);
但是我无法做任何事情。我希望它打印出状态和锁定或类似的东西。
这是我如何使用它:
grabber_queue = dispatch_queue_create(com.unpaq.tvguideplus.grabber,NULL);
dispatch_debug(grabber_queue,grabber queue);
dispatch_debug
将调试信息记录到控制台日志此信息可用作调试工具,用于在调用dispatch_debug函数时查看调度对象的内部状态(当前引用计数,暂停计数等)。
dispatch_debug将消息发送到syslog。因此,
grabber_queue = dispatch_queue_create(com.unpaq.tvguideplus.grabber,NULL);
dispatch_debug(grabber_queue,grabber queue);
此代码将在system.log中打印如下:
5月13日08:50:17 hostname exefile [53164]:com.unpaq.tvguideplus.grabber [0x6200e10] = {
xrefcnt = 0x1,refcnt = 0x1,suspend_cnt = 0x0,locked = 0,target =
com.apple.root.default-overcommit-priority [0x1af0700],width = 0x0,running = 0x0,
barrier = 0}:抓取队列
它不会出现在Xcode调试控制台中。您可以在iPhone模拟器上的/Applications/Utilities/Console.app system.log或iPhone,iPod touch和iPad上的Xcode组织者中看到。
顺便说一下,GCD是开源的。它通过 libdispatch 发布。 dispatch_debug包含在src / object.c中。
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
Debug information is logged to the Console log. This information can be useful as a debugging tool to view the internal state (current reference count, suspension count, etc.) of a dispatch object at the time the dispatch_debug function is called.
dispatch_debug sends messages to syslog. So,
grabber_queue = dispatch_queue_create("com.unpaq.tvguideplus.grabber", NULL);
dispatch_debug(grabber_queue, "grabber queue");
this code would print as the following in system.log.
May 13 08:50:17 hostname exefile[53164]: com.unpaq.tvguideplus.grabber[0x6200e10] = {
xrefcnt = 0x1, refcnt = 0x1, suspend_cnt = 0x0, locked = 0, target =
com.apple.root.default-overcommit-priority[0x1af0700], width = 0x0, running = 0x0,
barrier = 0 }: grabber queueMay
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.
这篇关于应该如何使用dispatch_debug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!