XDispatch 0.7.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
source.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
00003  * Copyright (c) 2011-2013 MLBA-Team. All rights reserved.
00004  *
00005  * @APPLE_APACHE_LICENSE_HEADER_START@
00006  * 
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  * 
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  * 
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  * 
00019  * @APPLE_APACHE_LICENSE_HEADER_END@
00020  */
00021 
00022 #ifndef __DISPATCH_SOURCE__
00023 #define __DISPATCH_SOURCE__
00024 
00030 #ifndef __DISPATCH_INDIRECT__
00031 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
00032 #include "base.h"  // for HeaderDoc
00033 #endif
00034 
00104 #ifdef _WIN32
00105 # define DISPATCH_SOURCE_HAS_DATA_ADD 1
00106 # define DISPATCH_SOURCE_HAS_DATA_OR 1
00107 # define DISPATCH_SOURCE_HAS_MACH_SEND 0
00108 # define DISPATCH_SOURCE_HAS_MACH_RECV 0
00109 # define DISPATCH_SOURCE_HAS_PROC 0
00110 # define DISPATCH_SOURCE_HAS_READ 0
00111 # define DISPATCH_SOURCE_HAS_SIGNAL 0
00112 # define DISPATCH_SOURCE_HAS_TIMER 1
00113 # define DISPATCH_SOURCE_HAS_VNODE 0
00114 # define DISPATCH_SOURCE_HAS_WRITE 0
00115 #elif defined __APPLE__
00116 # define DISPATCH_SOURCE_HAS_DATA_ADD 1
00117 # define DISPATCH_SOURCE_HAS_DATA_OR 1
00118 # define DISPATCH_SOURCE_HAS_MACH_SEND 1
00119 # define DISPATCH_SOURCE_HAS_MACH_RECV 1
00120 # define DISPATCH_SOURCE_HAS_PROC 1
00121 # define DISPATCH_SOURCE_HAS_READ 1
00122 # define DISPATCH_SOURCE_HAS_SIGNAL 1
00123 # define DISPATCH_SOURCE_HAS_TIMER 1
00124 # define DISPATCH_SOURCE_HAS_VNODE 1
00125 # define DISPATCH_SOURCE_HAS_WRITE 1
00126 #elif defined __linux__
00127 # define DISPATCH_SOURCE_HAS_DATA_ADD 1
00128 # define DISPATCH_SOURCE_HAS_DATA_OR 1
00129 # define DISPATCH_SOURCE_HAS_MACH_SEND 0
00130 # define DISPATCH_SOURCE_HAS_MACH_RECV 0
00131 # define DISPATCH_SOURCE_HAS_PROC 0
00132 # define DISPATCH_SOURCE_HAS_READ 1
00133 # define DISPATCH_SOURCE_HAS_SIGNAL 1
00134 # define DISPATCH_SOURCE_HAS_TIMER 1
00135 # define DISPATCH_SOURCE_HAS_VNODE 1
00136 # define DISPATCH_SOURCE_HAS_WRITE 1
00137 #else
00138 # warning "Completely unsupported platform, might result in errors"
00139 #endif
00140 
00145 DISPATCH_DECL(dispatch_source);
00146 
00155 typedef const struct dispatch_source_type_s *dispatch_source_type_t;
00156 
00157 __DISPATCH_BEGIN_DECLS
00158 
00159 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_DATA_ADD)
00160 
00167 #define DISPATCH_SOURCE_TYPE_DATA_ADD (&_dispatch_source_type_data_add)
00168 
00169 extern DISPATCH_EXPORT
00170 const struct dispatch_source_type_s _dispatch_source_type_data_add;
00171 
00172 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_DATA_ADD) */
00173 
00174 
00175 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_DATA_OR)
00176 
00184 #define DISPATCH_SOURCE_TYPE_DATA_OR (&_dispatch_source_type_data_or)
00185 
00186 extern DISPATCH_EXPORT
00187 const struct dispatch_source_type_s _dispatch_source_type_data_or;
00188 
00189 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_DATA_ADD) */
00190 
00191 
00192 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_MACH_SEND)
00193 
00200 #define DISPATCH_SOURCE_TYPE_MACH_SEND (&_dispatch_source_type_mach_send)
00201 
00202 extern DISPATCH_EXPORT
00203 const struct dispatch_source_type_s _dispatch_source_type_mach_send;
00204 
00205 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_MACH_SEND) */
00206 
00207 
00208 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_MACH_RECV)
00209 
00215 #define DISPATCH_SOURCE_TYPE_MACH_RECV (&_dispatch_source_type_mach_recv)
00216 
00217 extern DISPATCH_EXPORT
00218 const struct dispatch_source_type_s _dispatch_source_type_mach_recv;
00219 
00220 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_MACH_RECV) */
00221 
00222 
00223 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_PROC)
00224 
00231 #define DISPATCH_SOURCE_TYPE_PROC (&_dispatch_source_type_proc)
00232 
00233 extern DISPATCH_EXPORT
00234 const struct dispatch_source_type_s _dispatch_source_type_proc;
00235 
00236 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_PROC) */
00237 
00238 
00239 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_READ)
00240 
00247 #define DISPATCH_SOURCE_TYPE_READ (&_dispatch_source_type_read)
00248 
00249 extern DISPATCH_EXPORT
00250 const struct dispatch_source_type_s _dispatch_source_type_read;
00251 
00252 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_READ) */
00253 
00254 
00255 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_SIGNAL)
00256 
00262 #define DISPATCH_SOURCE_TYPE_SIGNAL (&_dispatch_source_type_signal)
00263 
00264 extern DISPATCH_EXPORT
00265 const struct dispatch_source_type_s _dispatch_source_type_signal;
00266 
00267 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_SIGNAL) */
00268 
00269 
00270 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_TIMER)
00271 
00278 #define DISPATCH_SOURCE_TYPE_TIMER (&_dispatch_source_type_timer)
00279 
00280 extern DISPATCH_EXPORT
00281 const struct dispatch_source_type_s _dispatch_source_type_timer;
00282 
00283 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_TIMER) */
00284 
00285 
00286 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_VNODE)
00287 
00294 #define DISPATCH_SOURCE_TYPE_VNODE (&_dispatch_source_type_vnode)
00295 
00296 extern DISPATCH_EXPORT
00297 const struct dispatch_source_type_s _dispatch_source_type_vnode;
00298 
00299 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_VNODE) */
00300 
00301 
00302 #if __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_WRITE)
00303 
00310 #define DISPATCH_SOURCE_TYPE_WRITE (&_dispatch_source_type_write)
00311 
00312 extern DISPATCH_EXPORT 
00313 const struct dispatch_source_type_s _dispatch_source_type_write;
00314 
00315 #endif /* __DISPATCH_BUILD_FEATURE(DISPATCH_SOURCE_HAS_WRITE) */
00316 
00317 __DISPATCH_END_DECLS
00318 
00322 enum {
00323     DISPATCH_MACH_SEND_DEAD = 0x1, 
00324 };
00325 
00329 enum {
00330     DISPATCH_PROC_EXIT = 0x80000000, 
00331     DISPATCH_PROC_FORK = 0x40000000, 
00332     DISPATCH_PROC_EXEC = 0x20000000, 
00333     DISPATCH_PROC_SIGNAL = 0x08000000, 
00334 };
00335 
00339 enum {
00340     DISPATCH_VNODE_DELETE = 0x1, 
00341     DISPATCH_VNODE_WRITE = 0x2, 
00342     DISPATCH_VNODE_EXTEND = 0x4, 
00343     DISPATCH_VNODE_ATTRIB = 0x8, 
00344     DISPATCH_VNODE_LINK     = 0x10, 
00345     DISPATCH_VNODE_RENAME = 0x20, 
00346     DISPATCH_VNODE_REVOKE = 0x40, 
00347 };
00348 
00349 __DISPATCH_BEGIN_DECLS
00350 
00377 DISPATCH_EXPORT  
00378 dispatch_source_t
00379 dispatch_source_create(dispatch_source_type_t type,
00380        uintptr_t handle,
00381        unsigned long mask,
00382        dispatch_queue_t queue);
00383 
00394 #ifdef __BLOCKS__
00395 
00396 DISPATCH_EXPORT  
00397 void
00398 dispatch_source_set_event_handler(dispatch_source_t source,
00399        dispatch_block_t handler);
00400 #endif /* __BLOCKS__ */
00401 
00416 DISPATCH_EXPORT  
00417 void
00418 dispatch_source_set_event_handler_f(dispatch_source_t source,
00419        dispatch_function_t handler);
00420 
00444 #ifdef __BLOCKS__
00445 
00446 DISPATCH_EXPORT  
00447 void
00448 dispatch_source_set_cancel_handler(dispatch_source_t source,
00449        dispatch_block_t cancel_handler);
00450 #endif /* __BLOCKS__ */
00451 
00467 DISPATCH_EXPORT  
00468 void
00469 dispatch_source_set_cancel_handler_f(dispatch_source_t source,
00470        dispatch_function_t cancel_handler);
00471 
00491 DISPATCH_EXPORT  
00492 void
00493 dispatch_source_cancel(dispatch_source_t source);
00494 
00506 DISPATCH_EXPORT  
00507 long
00508 dispatch_source_testcancel(dispatch_source_t source);
00509 
00532 DISPATCH_EXPORT    
00533 uintptr_t
00534 dispatch_source_get_handle(dispatch_source_t source);
00535 
00558 DISPATCH_EXPORT    
00559 unsigned long
00560 dispatch_source_get_mask(dispatch_source_t source);
00561 
00590 DISPATCH_EXPORT    
00591 unsigned long
00592 dispatch_source_get_data(dispatch_source_t source);
00593 
00608 DISPATCH_EXPORT  
00609 void
00610 dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
00611 
00640 DISPATCH_EXPORT  
00641 void
00642 dispatch_source_set_timer(dispatch_source_t source,
00643        dispatch_time_t start,
00644        uint64_t interval,
00645        uint64_t leeway);
00646 
00647 __DISPATCH_END_DECLS
00648 
00651 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Jan 27 2013 21:21:52 for XDispatch by Doxygen 1.7.6.1
© 2010-2013 MLBA (about | privacy) All Rights reserved.