2 * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
22 * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch
23 * which are subject to change in future releases of Mac OS X. Any applications
24 * relying on these interfaces WILL break.
27 #ifndef __DISPATCH_QUEUE_PRIVATE__
28 #define __DISPATCH_QUEUE_PRIVATE__
30 #ifndef __DISPATCH_INDIRECT__
31 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
32 #include <dispatch/base.h> // for HeaderDoc
39 * @enum dispatch_queue_flags_t
41 * @constant DISPATCH_QUEUE_OVERCOMMIT
42 * The queue will create a new thread for invoking blocks, regardless of how
43 * busy the computer is.
46 DISPATCH_QUEUE_OVERCOMMIT
= 0x2ull
,
49 #define DISPATCH_QUEUE_FLAGS_MASK (DISPATCH_QUEUE_OVERCOMMIT)
52 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_NA
)
53 DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
55 dispatch_barrier_sync(dispatch_queue_t queue
, dispatch_block_t block
);
58 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_NA
)
59 DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
61 dispatch_barrier_sync_f(dispatch_queue_t dq
, void *context
, dispatch_function_t work
);
64 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_NA
)
65 DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
67 dispatch_barrier_async(dispatch_queue_t queue
, dispatch_block_t block
);
70 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_NA
)
71 DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
73 dispatch_barrier_async_f(dispatch_queue_t dq
, void *context
, dispatch_function_t work
);
76 * @function dispatch_queue_set_width
79 * Set the width of concurrency for a given queue. The default width of a
80 * privately allocated queue is one.
83 * The queue to adjust. Passing the main queue, a default concurrent queue or
84 * any other default queue will be ignored.
87 * The new maximum width of concurrency depending on available resources.
88 * If zero is passed, then the value is promoted to one.
89 * Negative values are magic values that map to automatic width values.
90 * Unknown negative values default to DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS.
92 #define DISPATCH_QUEUE_WIDTH_ACTIVE_CPUS -1
93 #define DISPATCH_QUEUE_WIDTH_MAX_PHYSICAL_CPUS -2
94 #define DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS -3
96 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_NA
)
97 DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
99 dispatch_queue_set_width(dispatch_queue_t dq
, long width
);
103 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_NA
)
104 extern const struct dispatch_queue_offsets_s
{
105 // always add new fields at the end
106 const uint16_t dqo_version
;
107 const uint16_t dqo_label
;
108 const uint16_t dqo_label_size
;
109 const uint16_t dqo_flags
;
110 const uint16_t dqo_flags_size
;
111 const uint16_t dqo_serialnum
;
112 const uint16_t dqo_serialnum_size
;
113 const uint16_t dqo_width
;
114 const uint16_t dqo_width_size
;
115 const uint16_t dqo_running
;
116 const uint16_t dqo_running_size
;
117 } dispatch_queue_offsets
;