Iphone 如何使用dispatch_debug?
我正在努力解决GCD代码中的死锁问题。然后我在头文件Iphone 如何使用dispatch_debug?,iphone,multithreading,debugging,grand-central-dispatch,Iphone,Multithreading,Debugging,Grand Central Dispatch,我正在努力解决GCD代码中的死锁问题。然后我在头文件中看到了这个函数dispatch\u debug 但我不能让它做任何事。我希望它能打印出州和锁之类的东西 以下是我如何使用它: grabber_queue = dispatch_queue_create("com.unpaq.tvguideplus.grabber", NULL); dispatch_debug(grabber_queue, "grabber queue"); 调度调试 调试信息记录到控制台日志中。此信息可用作调试工具,
中看到了这个函数dispatch\u debug
但我不能让它做任何事。我希望它能打印出州和锁之类的东西
以下是我如何使用它:
grabber_queue = dispatch_queue_create("com.unpaq.tvguideplus.grabber", NULL);
dispatch_debug(grabber_queue, "grabber queue");
grabber_queue = dispatch_queue_create("com.unpaq.tvguideplus.grabber", NULL);
dispatch_debug(grabber_queue, "grabber queue");
此代码将在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
它不会出现在Xcode调试控制台中。您可以在iPhone模拟器上的/Applications/Utilities/Console.app system.log中看到,也可以在iPhone、iPod touch和iPad上的Xcode organizer中看到
顺便说一下,GCD是开源的。它是通过网络分发的。调度调试包含在src/object.c中
grabber_queue = dispatch_queue_create("com.unpaq.tvguideplus.grabber", NULL);
dispatch_debug(grabber_queue, "grabber queue");
此代码将在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
它不会出现在Xcode调试控制台中。您可以在iPhone模拟器上的/Applications/Utilities/Console.app system.log中看到,也可以在iPhone、iPod touch和iPad上的Xcode organizer中看到
顺便说一下,GCD是开源的。它是通过网络分发的。调度调试包含在src/object.c中
调度调试()。文档没有说明打算使用什么,但我发现现在您可以处理dispatch\u object\t
对象,如NSObject
对象:
(lldb) po _connectScanTimer
<OS_dispatch_source: kevent-source[0x15d47440] = { xrefcnt = 0x1, refcnt = 0x2, suspend_cnt = 0x7fffffff, locked = 0, target = [0x15d7ca50], ident = 0x4, pending_data = 0x1, pending_data_mask = 0x0, timer = { target = 0x48841e442a, deadline = 0x488479d1aa, last_fire = 0x48808ac1cc, interval = 0x3938700, flags = 0x0 }, filter = DISPATCH_EVFILT_TIMER }>
(lldb)po\u连接扫描计时器
这意味着您可以使用description
和方法来获取有关dispatch\u object\t
对象的一些信息。从iOS 6.0开始dispatch\u debug()。文档没有说明打算使用什么,但我发现现在您可以处理dispatch\u object\t
对象,如NSObject
对象:
(lldb) po _connectScanTimer
<OS_dispatch_source: kevent-source[0x15d47440] = { xrefcnt = 0x1, refcnt = 0x2, suspend_cnt = 0x7fffffff, locked = 0, target = [0x15d7ca50], ident = 0x4, pending_data = 0x1, pending_data_mask = 0x0, timer = { target = 0x48841e442a, deadline = 0x488479d1aa, last_fire = 0x48808ac1cc, interval = 0x3938700, flags = 0x0 }, filter = DISPATCH_EVFILT_TIMER }>
(lldb)po\u连接扫描计时器
这意味着您可以使用description
和方法获取有关dispatch\u object\t
对象的一些信息。非常好。很遗憾,我无法在调试控制台中看到它。但至少现在我知道了原因。我代表@Dododit:@“我对iPhone模拟器上的System.log感到困惑。要查找System.log文件,请在finder中,转到左侧面板中的/Applications/Utilities/Console.app,您将在文件下拉菜单下找到System.log”您可以将输出重定向到控制台-请参阅此博客上的dispatch_debug:您能告诉我什么是locked=0吗?此函数现在已被弃用:请参阅@werediver belowExcellent的答案。很遗憾,我无法在调试控制台中看到它。但至少现在我知道了原因。我代表@Dododit:@“我对iPhone模拟器上的System.log感到困惑。要查找System.log文件,请在finder中,转到左侧面板中的/Applications/Utilities/Console.app,您将在文件下拉菜单下找到System.log”您可以将输出重定向到控制台-请参阅本博客上的dispatch_debug:您能告诉我什么是locked=0吗?此函数现在已被弃用:请参阅下面@werediver的答案查看它,我强烈怀疑这是我们不应该使用的私有SDK的一部分。在这种情况下,答案是“你不需要”。看着它,我强烈怀疑这是我们不应该使用的私有SDK的一部分。在这种情况下,答案是“你没有”。