GDC
来源:互联网 发布:mac卸载自带软件 编辑:程序博客网 时间:2024/05/15 23:10
UIApplicationMain
(iOS)或 NSApplicationMain
(OS X)CFRunLoopRef
dispatch_suspend
, dispatch_resume
, dispatch_set_context,
并且没有影响使用的队列被功能返回。
dispatch_get_global_queue
返回拥有指定的服务质量的系统定义的全局并发队列
dispatch_queue_t dispatch_get_global_queue ( long identifier, unsigned long flags )
identifier:你想要使用队列执行队列,服务质量帮助决定被队列执行的任务的优先级。你能指定值QOS_CLASS_USER_INTERACTIVE
, QOS_CLASS_USER_INITIATED
, QOS_CLASS_UTILITY
,或
dispatch_suspend
, dispatch_resume 和
dispatch_set_context 功能不影响返回队列sample
, stackshots, 和 crash reports 。因为应用库和框架都能创建他们自己的调度队列,一个反DNS的命名方式被推荐。这个参数是可选项可以为0DISPATCH_QUEUE_SERIAL
(或 NULL
)来创建连续的队列或指定DISPATCH_QUEUE_CONCURRENT
来创建一个并发的队列。在较早的版本这个参数必须指定为空Creating and Managing Queues
dispatch_get_main_queue
Returns the serial dispatch queue associated with the application’s main thread.
Declaration
SWIFT
func dispatch_get_main_queue() -> dispatch_queue_t!
OBJECTIVE-C
dispatch_queue_t dispatch_get_main_queue ( void );
Return Value
Returns the main queue. This queue is created automatically on behalf of the main thread before
main
is called.Discussion
The main queue is automatically created by the system and associated with your application’s main thread. Your application uses one (and only one) of the following three approaches to invoke blocks submitted to the main queue:
Calling
dispatch_main
Calling
UIApplicationMain
(iOS) orNSApplicationMain
(OS X)Using a
CFRunLoopRef
on the main thread
As with the global concurrent queues, calls to
dispatch_suspend
,dispatch_resume
,dispatch_set_context
, and the like have no effect when used with queues returned by this function.Import Statement
import Dispatch
Availability
Available in iOS 4.0 and later
dispatch_get_global_queue
Returns a system-defined global concurrent queue with the specified quality of service class.
Declaration
SWIFT
func dispatch_get_global_queue(_
identifier
: Int,
_flags
: UInt) -> dispatch_queue_t!OBJECTIVE-C
dispatch_queue_t dispatch_get_global_queue ( long identifier, unsigned long flags );
Parameters
identifier
The quality of service you want to give to tasks executed using this queue. Quality-of-service helps determine the priority given to tasks executed by the queue. You may specify the values
QOS_CLASS_USER_INTERACTIVE
,QOS_CLASS_USER_INITIATED
,QOS_CLASS_UTILITY
, orQOS_CLASS_BACKGROUND
. Queues that handle user-interactive or user-initiated tasks have a higher priority than tasks meant to run in the background.You may also specify one of the dispatch queue priority values, which are found in
dispatch_queue_priority_t
. These values map to an appropriate quality-of-service class.flags
Flags that are reserved for future use. Always specify
0
for this parameter.Return Value
The requested global concurrent queue.
Discussion
This function returns a queue suitable for executing tasks with the specified quality-of-service level. Calls to the
dispatch_suspend
,dispatch_resume
, anddispatch_set_context
functions have no effect on the returned queues.Tasks submitted to the returned queue are scheduled concurrently with respect to one another.
Import Statement
import Dispatch
Availability
Available in iOS 4.0 and later.
dispatch_queue_create
Creates a new dispatch queue to which blocks can be submitted.
Declaration
SWIFT
func dispatch_queue_create(_
label
: UnsafePointer<Int8>,
_attr
: dispatch_queue_attr_t!) -> dispatch_queue_t!OBJECTIVE-C
dispatch_queue_t dispatch_queue_create ( const char *label, dispatch_queue_attr_t attr );
Parameters
label
A string label to attach to the queue to uniquely identify it in debugging tools such as Instruments,
sample
, stackshots, and crash reports. Because applications, libraries, and frameworks can all create their own dispatch queues, a reverse-DNS naming style (com.example.myqueue) is recommended. This parameter is optional and can beNULL
.attr
In OS X v10.7 and later or iOS 4.3 and later, specify
DISPATCH_QUEUE_SERIAL
(orNULL
) to create a serial queue or specifyDISPATCH_QUEUE_CONCURRENT
to create a concurrent queue. In earlier versions, you must specifyNULL
for this parameter.Return Value
The newly created dispatch queue.
Discussion
Blocks submitted to a serial queue are executed one at a time in FIFO order. Note, however, that blocks submitted to independent queues may be executed concurrently with respect to each other. Blocks submitted to a concurrent queue are dequeued in FIFO order but may run concurrently if resources are available to do so.
When your application no longer needs the dispatch queue, it should release it with the
dispatch_release
function. Any pending blocks submitted to a queue hold a reference to that queue, so the queue is not deallocated until all pending blocks have completed.Import Statement
import Dispatch
Availability
Available in iOS 4.0 and later.
dispatch_get_current_queue
(iOS 6.0)Returns the queue on which the currently executing block is running.
Declaration
OBJECTIVE-C
dispatch_queue_t dispatch_get_current_queue ( void );
Return Value
Returns the current queue.
Discussion
This function is defined to never return
NULL
.When called from outside of the context of a submitted block, this function returns the main queue if the call is executed from the main thread. If the call is made from any other thread, this function returns the default concurrent queue.
Import Statement
Availability
Available in iOS 4.0 and later.
Deprecated in iOS 6.0.
- GDC
- GDC dispatch_semaphore
- GDC行业新闻
- GDC dispatch_semaphore
- GDC dispatch_semaphore
- GDC dispatch_semaphore
- GDC dispatch_semaphore
- 2010 GDC观后感
- GDC介绍和使用
- IBM GDC 招聘贴
- 求最大公约数gdc算法
- GDC的理解
- IBM GDC 面试经验
- GDC项目组主要任务
- GDC Tips For Students & The GDC Survival Guide
- 20091101 IBM GDC 职位列表
- AMD Gaming Evolved - GDC 2010
- 2010年GDC会议记录之一
- 用CSS实现超长的字符变成省略号
- POJ 2886 Who Gets the Most Candies?(线段树)
- WEB安全:SQL注入
- 重新将数据库注册到RMAN Catalog时偶遇ORA-02291错误之探查
- hdu 2296 Ring(AC自动机+DP)
- GDC
- nfs文件系统挂载不上
- 真正优秀的程序员不喜欢随便跳槽
- 大规模分布式存储系统-读书笔记0
- 注释你的代码
- ViewDragHelper详解(一)- 可拖动的view
- Maven之——Nexus创建仓库
- 在程序中了解自己的运行环境--笔记
- 管理程序员的问题也是重中之重