00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __DISPATCH_SOURCE__
00022 #define __DISPATCH_SOURCE__
00023
00024 #ifndef __DISPATCH_INDIRECT__
00025 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00026 #include "base.h"
00027 #endif
00028
00046 DISPATCH_DECL(dispatch_source);
00047
00059 typedef const struct dispatch_source_type_s *dispatch_source_type_t;
00060
00061 __DISPATCH_BEGIN_DECLS
00062
00070 #define DISPATCH_SOURCE_TYPE_DATA_ADD (&_dispatch_source_type_data_add)
00071 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00072 extern DISPATCH_EXPORT
00073 const struct dispatch_source_type_s _dispatch_source_type_data_add;
00074
00083 #define DISPATCH_SOURCE_TYPE_DATA_OR (&_dispatch_source_type_data_or)
00084 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00085 extern DISPATCH_EXPORT
00086 const struct dispatch_source_type_s _dispatch_source_type_data_or;
00087
00095 #define DISPATCH_SOURCE_TYPE_MACH_SEND (&_dispatch_source_type_mach_send)
00096 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00097 extern DISPATCH_EXPORT
00098 const struct dispatch_source_type_s _dispatch_source_type_mach_send;
00099
00106 #define DISPATCH_SOURCE_TYPE_MACH_RECV (&_dispatch_source_type_mach_recv)
00107 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00108 extern DISPATCH_EXPORT
00109 const struct dispatch_source_type_s _dispatch_source_type_mach_recv;
00110
00118 #define DISPATCH_SOURCE_TYPE_PROC (&_dispatch_source_type_proc)
00119 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00120 extern DISPATCH_EXPORT
00121 const struct dispatch_source_type_s _dispatch_source_type_proc;
00122
00130 #define DISPATCH_SOURCE_TYPE_READ (&_dispatch_source_type_read)
00131 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00132 extern DISPATCH_EXPORT
00133 const struct dispatch_source_type_s _dispatch_source_type_read;
00134
00141 #define DISPATCH_SOURCE_TYPE_SIGNAL (&_dispatch_source_type_signal)
00142 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00143 extern DISPATCH_EXPORT
00144 const struct dispatch_source_type_s _dispatch_source_type_signal;
00145
00153 #define DISPATCH_SOURCE_TYPE_TIMER (&_dispatch_source_type_timer)
00154 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00155 extern DISPATCH_EXPORT
00156 const struct dispatch_source_type_s _dispatch_source_type_timer;
00157
00165 #define DISPATCH_SOURCE_TYPE_VNODE (&_dispatch_source_type_vnode)
00166 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00167 extern DISPATCH_EXPORT
00168 const struct dispatch_source_type_s _dispatch_source_type_vnode;
00169
00177 #define DISPATCH_SOURCE_TYPE_WRITE (&_dispatch_source_type_write)
00178 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00179 extern DISPATCH_EXPORT
00180 const struct dispatch_source_type_s _dispatch_source_type_write;
00181
00182 __DISPATCH_END_DECLS
00183
00190 enum {
00191 DISPATCH_MACH_SEND_DEAD = 0x1,
00192 };
00193
00210 enum {
00211 DISPATCH_PROC_EXIT = 0x80000000,
00212 DISPATCH_PROC_FORK = 0x40000000,
00213 DISPATCH_PROC_EXEC = 0x20000000,
00214 DISPATCH_PROC_SIGNAL = 0x08000000,
00215 };
00216
00241 enum {
00242 DISPATCH_VNODE_DELETE = 0x1,
00243 DISPATCH_VNODE_WRITE = 0x2,
00244 DISPATCH_VNODE_EXTEND = 0x4,
00245 DISPATCH_VNODE_ATTRIB = 0x8,
00246 DISPATCH_VNODE_LINK = 0x10,
00247 DISPATCH_VNODE_RENAME = 0x20,
00248 DISPATCH_VNODE_REVOKE = 0x40,
00249 };
00250
00251 __DISPATCH_BEGIN_DECLS
00252
00282 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00283 DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_NOTHROW
00284 dispatch_source_t
00285 dispatch_source_create(dispatch_source_type_t type,
00286 uintptr_t handle,
00287 unsigned long mask,
00288 dispatch_queue_t queue);
00289
00303 #ifdef __BLOCKS__
00304 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00305 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
00306 void
00307 dispatch_source_set_event_handler(dispatch_source_t source,
00308 dispatch_block_t handler);
00309 #endif
00310
00327 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00328 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
00329 void
00330 dispatch_source_set_event_handler_f(dispatch_source_t source,
00331 dispatch_function_t handler);
00332
00360 #ifdef __BLOCKS__
00361 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00362 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
00363 void
00364 dispatch_source_set_cancel_handler(dispatch_source_t source,
00365 dispatch_block_t cancel_handler);
00366 #endif
00367
00386 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00387 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
00388 void
00389 dispatch_source_set_cancel_handler_f(dispatch_source_t source,
00390 dispatch_function_t cancel_handler);
00391
00414 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00415 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
00416 void
00417 dispatch_source_cancel(dispatch_source_t source);
00418
00432 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00433 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
00434 long
00435 dispatch_source_testcancel(dispatch_source_t source);
00436
00461 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00462 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW
00463 uintptr_t
00464 dispatch_source_get_handle(dispatch_source_t source);
00465
00490 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00491 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW
00492 unsigned long
00493 dispatch_source_get_mask(dispatch_source_t source);
00494
00526 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00527 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW
00528 unsigned long
00529 dispatch_source_get_data(dispatch_source_t source);
00530
00547 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00548 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
00549 void
00550 dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
00551
00583 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
00584 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
00585 void
00586 dispatch_source_set_timer(dispatch_source_t source,
00587 dispatch_time_t start,
00588 uint64_t interval,
00589 uint64_t leeway);
00590
00591 __DISPATCH_END_DECLS
00592
00593 #endif