【发布时间】:2013-12-30 21:50:15
【问题描述】:
我正在使用 GCD 对 SQL 数据库执行大量数据提交和数据读取操作,我创建了串行队列并执行我正在使用 dispatch_async 的操作。
队列创建代码:
self.dataBaseQueue = dispatch_queue_create("com.myAPP.dataBaseQueue", DISPATCH_QUEUE_SERIAL);
执行代码
dispatch_async(self.dataBaseQueue, codeblock);
代码块包含数据库操作读取或写入。
现在当我登录队列的debugDescription 时,它正在打印
OS_dispatch_queue: com.myAPP.dataBaseQueue[0x1cd58ae0] = { xrefcnt = 0x1, refcnt = 0x1, suspend_cnt = 0x0, **locked = 0**, target = com.apple.root.default-overcommit-priority[0x3d335300], width = 0x0, running = 0x0, barrier = 0 }
经过一些操作后,它正在打印
OS_dispatch_queue: com.myAPP.dataBaseQueue[0x1cd58ae0] = { xrefcnt = 0x1, refcnt = 0x1, suspend_cnt = 0x0, **locked = 1**, target = com.apple.root.default-overcommit-priority[0x3d335300], width = 0x0, running = 0x0, barrier = 0 }
那么locked =1和locked =0是什么意思?
【问题讨论】:
-
什么是
debugDescription?是dispatch_debug的输出吗? -
是的,它就像 dispatch_debug。
-
您可能会发现 libdispatch 库的来源很有帮助:libdispatch.macosforge.org
标签: ios objective-c grand-central-dispatch