]> git.saurik.com Git - apple/libdispatch.git/blob - src/queue_private.h
libdispatch-84.5.5.tar.gz
[apple/libdispatch.git] / src / queue_private.h
1 /*
2 * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
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
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
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.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20
21 /*
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.
25 */
26
27 #ifndef __DISPATCH_QUEUE_PRIVATE__
28 #define __DISPATCH_QUEUE_PRIVATE__
29
30 #ifndef __DISPATCH_INDIRECT__
31 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
32 #include <dispatch/base.h> // for HeaderDoc
33 #endif
34
35 __BEGIN_DECLS
36
37
38 /*!
39 * @enum dispatch_queue_flags_t
40 *
41 * @constant DISPATCH_QUEUE_OVERCOMMIT
42 * The queue will create a new thread for invoking blocks, regardless of how
43 * busy the computer is.
44 */
45 enum {
46 DISPATCH_QUEUE_OVERCOMMIT = 0x2ull,
47 };
48
49 #define DISPATCH_QUEUE_FLAGS_MASK (DISPATCH_QUEUE_OVERCOMMIT)
50
51 #ifdef __BLOCKS__
52 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
53 DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
54 void
55 dispatch_barrier_sync(dispatch_queue_t queue, dispatch_block_t block);
56 #endif
57
58 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
59 DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
60 void
61 dispatch_barrier_sync_f(dispatch_queue_t dq, void *context, dispatch_function_t work);
62
63 #ifdef __BLOCKS__
64 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
65 DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
66 void
67 dispatch_barrier_async(dispatch_queue_t queue, dispatch_block_t block);
68 #endif
69
70 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
71 DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
72 void
73 dispatch_barrier_async_f(dispatch_queue_t dq, void *context, dispatch_function_t work);
74
75 /*!
76 * @function dispatch_queue_set_width
77 *
78 * @abstract
79 * Set the width of concurrency for a given queue. The default width of a
80 * privately allocated queue is one.
81 *
82 * @param queue
83 * The queue to adjust. Passing the main queue, a default concurrent queue or
84 * any other default queue will be ignored.
85 *
86 * @param width
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.
91 */
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
95
96 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
97 DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
98 void
99 dispatch_queue_set_width(dispatch_queue_t dq, long width);
100
101
102
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;
118
119
120 __END_DECLS
121
122 #endif