gpt4 book ai didi

iphone - 如何申报 Grand Central Dispatch

转载 作者:行者123 更新时间:2023-12-01 18:30:45 57 4
gpt4 key购买 nike

我正在使用我为 GCD 找到的一个相当不错的教程,它向您展示了如何声明一个新的调度队列。

Grand Central Dispatch operates using queues. Queues are a C typedef: dispatch_queue_t. To get a new global queue, we call dispatch_get_global_queue(), which takes two arguments: a long for priority and an unsigned long for options, which is unused, so we’ll pass 0ul. Here’s how we get a high-priority queue:



在其中它说像这样将 0ul 作为参数传递
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);

我希望有人可以向我解释 0ul 是什么?为什么它包括在内?

最佳答案

它只是 0 并且 ul 告诉编译器您希望它是无符号长整数以匹配函数签名。

dispatch_queue_t dispatch_get_global_queue(长优先级,无符号长标志);

如果您不添加 ul,0 将被视为整数,这可能会导致编译器警告。

请在此处查看文档。

https://developer.apple.com/library/mac/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html

关于iphone - 如何申报 Grand Central Dispatch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9186842/

57 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com