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_SOURCE_INTERNAL__
28 #define __DISPATCH_SOURCE_INTERNAL__
30 #ifndef __DISPATCH_INDIRECT__
31 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
32 #include <dispatch/base.h> // for HeaderDoc
35 struct dispatch_source_vtable_s
{
36 DISPATCH_VTABLE_HEADER(dispatch_source_s
);
39 extern const struct dispatch_source_vtable_s _dispatch_source_kevent_vtable
;
41 struct dispatch_kevent_s
{
42 TAILQ_ENTRY(dispatch_kevent_s
) dk_list
;
43 TAILQ_HEAD(, dispatch_source_s
) dk_sources
;
44 struct kevent dk_kevent
;
47 typedef struct dispatch_kevent_s
*dispatch_kevent_t
;
49 struct dispatch_timer_source_s
{
54 uint64_t flags
; // dispatch_timer_flags_t
57 #define DSF_CANCELED 1u // cancellation has been requested
59 struct dispatch_source_s
{
60 DISPATCH_STRUCT_HEADER(dispatch_source_s
, dispatch_source_vtable_s
);
61 DISPATCH_QUEUE_HEADER
;
62 // Instruments always copies DISPATCH_QUEUE_MIN_LABEL_SIZE, which is 64,
63 // so the remainder of the structure must be big enough
65 char _ds_pad
[DISPATCH_QUEUE_MIN_LABEL_SIZE
];
68 dispatch_kevent_t ds_dkev
;
70 dispatch_source_handler_function_t ds_handler_func
;
71 void *ds_handler_ctxt
;
73 void *ds_cancel_handler
;
75 unsigned int ds_is_level
:1,
82 ds_handler_is_block
:1;
84 unsigned int ds_atomic_flags
;
86 unsigned long ds_data
;
87 unsigned long ds_pending_data
;
88 unsigned long ds_pending_data_mask
;
90 TAILQ_ENTRY(dispatch_source_s
) ds_list
;
92 unsigned long ds_ident_hack
;
94 struct dispatch_timer_source_s ds_timer
;
100 void _dispatch_source_legacy_xref_release(dispatch_source_t ds
);
102 #endif /* __DISPATCH_SOURCE_INTERNAL__ */