- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在 Apple 的示例代码中,AVCam-iOS: Using AVFoundation to Capture Images and Movies ,我注意到以下一行:
// Communicate with the session and other session objects on this queue.
self.sessionQueue = dispatch_queue_create( "session queue", DISPATCH_QUEUE_SERIAL );
我想知道第二个参数是关于什么的,除了 DISPATCH_QUEUE_SERIAL
我们还有哪些其他选项?
令人困惑的是,在其他 Apple 文档中,它说第二个参数是保留的,应该设置为 NULL
。似乎文档已过时,任何人都可以解释第二个参数应该是什么吗?
The dispatch_queue_create function takes two parameters: the queue name and a set of queue attributes. The queue attributes are reserved for future use and should be NULL. Concurrency Programming Guide
最佳答案
dispatch_queue_t dispatch_queue_create(const char *label, dispatch_queue_attr_t attr);
Queues are created with the dispatch_queue_create() function. Queues, like all dispatch objects, are reference counted and newly created queues have a reference count of one.
The optional label argument is used to describe the purpose of the queue and is useful during debugging and performance analysis. If a label is provided, it is copied. By convention, clients should pass a reverse DNS style label. For example:
my_queue = dispatch_queue_create("com.example.subsystem.taskXYZ", NULL);
The attr argument specifies the type of queue to create and must be either DISPATCH_QUEUE_SERIAL or DISPATCH_QUEUE_CONCURRENT.
关于ios - 什么是 dispatch_queue_create 中的队列属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35828520/
我需要在为它们创建的自定义线程上执行一小组相关任务。这些任务将从不同的类(class)安排。我打算使用 GCD 的 dispatch_queue_create 创建自定义线程并在其上安排任务。请注意,
目前在我的代码中正在使用 dispatch_async(dispatch_queue_create("myQueue", nil) , { () -> Void in 现在我有必要在我的代码中调用此代
在 Apple 的示例代码中,AVCam-iOS: Using AVFoundation to Capture Images and Movies ,我注意到以下一行: // Communicate
有一个加载的 View 和一个创建的串行调度队列,在后台加载大量内容并且效果很好。问题是,当我来回导航到该 View 时,会再次创建一个新队列,然后我有多个东西在做完全相同的工作。 - (void)v
我正在编写一个中等复杂的 iOS 程序,它需要有多个线程来执行一些较长的操作(解析、连接到网络等)。但是,我对 dispatch_get_global_queue 和 dispatch_queue_c
我在我的 iOS 应用程序中创建了这个线程,我想停止它: dispatch_queue_t myDispatch = dispatch_queue_create("com.myqueue", DISP
我有以下代码 dispatch_queue_t dispatch_get_local_queue() { static dispatch_queue_t _queue; static
我正在将一些代码从 C++ 移植到使用 Grand Central Dispatch 的 Swift,我发现 dispatch_queue_create 似乎根本不起作用的奇怪错误。 例如,在我的 C
我声明了一个引用 GCD 队列的属性: @property (assign) dispatch_queue_t backgroundQueue; 在类的 init 方法中我创建了一个串行队列: bac
我是一名优秀的程序员,十分优秀!