libXDispatch 0.3.1
include/libdispatch/source.h
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
00003 * Copyright (c) 2011 MLBA. All rights reserved.
00004 *
00005 * @MLBA_OPEN_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 * @MLBA_OPEN_LICENSE_HEADER_END@
00020 */
00021 
00022 
00023 
00024 #ifndef __DISPATCH_SOURCE__
00025 #define __DISPATCH_SOURCE__
00026 
00027 #ifndef __DISPATCH_INDIRECT__
00028 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00029 #include "base.h" // for HeaderDoc
00030 #endif
00031 
00049 DISPATCH_DECL(dispatch_source);
00050 
00062 typedef const struct dispatch_source_type_s *dispatch_source_type_t;
00063 
00071 #define DISPATCH_SOURCE_TYPE_DATA_ADD (&_dispatch_source_type_data_add)
00072 const struct dispatch_source_type_s _dispatch_source_type_data_add;
00073 
00082 #define DISPATCH_SOURCE_TYPE_DATA_OR (&_dispatch_source_type_data_or)
00083 const struct dispatch_source_type_s _dispatch_source_type_data_or;
00084 
00092 #define DISPATCH_SOURCE_TYPE_MACH_SEND (&_dispatch_source_type_mach_send)
00093 const struct dispatch_source_type_s _dispatch_source_type_mach_send;
00094 
00101 #define DISPATCH_SOURCE_TYPE_MACH_RECV (&_dispatch_source_type_mach_recv)
00102 const struct dispatch_source_type_s _dispatch_source_type_mach_recv;
00103 
00111 #define DISPATCH_SOURCE_TYPE_PROC (&_dispatch_source_type_proc)
00112 const struct dispatch_source_type_s _dispatch_source_type_proc;
00113 
00121 #define DISPATCH_SOURCE_TYPE_READ (&_dispatch_source_type_read)
00122 const struct dispatch_source_type_s _dispatch_source_type_read;
00123 
00130 #define DISPATCH_SOURCE_TYPE_SIGNAL (&_dispatch_source_type_signal)
00131 const struct dispatch_source_type_s _dispatch_source_type_signal;
00132 
00140 #define DISPATCH_SOURCE_TYPE_TIMER (&_dispatch_source_type_timer)
00141 const struct dispatch_source_type_s _dispatch_source_type_timer;
00142 
00150 #define DISPATCH_SOURCE_TYPE_VNODE (&_dispatch_source_type_vnode)
00151 const struct dispatch_source_type_s _dispatch_source_type_vnode;
00152 
00160 #define DISPATCH_SOURCE_TYPE_WRITE (&_dispatch_source_type_write)
00161 const struct dispatch_source_type_s _dispatch_source_type_write;
00162 
00169 enum {
00170        DISPATCH_MACH_SEND_DEAD = 0x1,
00171 };
00172 
00189 enum {
00190        DISPATCH_PROC_EXIT = 0x80000000,
00191        DISPATCH_PROC_FORK = 0x40000000,
00192        DISPATCH_PROC_EXEC = 0x20000000,
00193        DISPATCH_PROC_SIGNAL = 0x08000000,
00194 };
00195 
00220 enum {
00221        DISPATCH_VNODE_DELETE = 0x1,
00222        DISPATCH_VNODE_WRITE = 0x2,
00223        DISPATCH_VNODE_EXTEND = 0x4,
00224        DISPATCH_VNODE_ATTRIB = 0x8,
00225        DISPATCH_VNODE_LINK  = 0x10,
00226        DISPATCH_VNODE_RENAME = 0x20,
00227        DISPATCH_VNODE_REVOKE = 0x40,
00228 };
00229 
00230 __DISPATCH_BEGIN_DECLS
00231 
00261 dispatch_source_t
00262 dispatch_source_create(dispatch_source_type_t type,
00263        uintptr_t handle,
00264        unsigned long mask,
00265        dispatch_queue_t queue);
00266 
00280 #ifdef XDISPATCH_HAS_BLOCKS
00281 void
00282 dispatch_source_set_event_handler(dispatch_source_t source,
00283        dispatch_block_t handler);
00284 #endif /* XDISPATCH_HAS_BLOCKS */
00285 
00302 void
00303 dispatch_source_set_event_handler_f(dispatch_source_t source,
00304        dispatch_function_t handler);
00305 
00333 #ifdef XDISPATCH_HAS_BLOCKS
00334 void
00335 dispatch_source_set_cancel_handler(dispatch_source_t source,
00336        dispatch_block_t cancel_handler);
00337 #endif /* XDISPATCH_HAS_BLOCKS */
00338 
00357 void
00358 dispatch_source_set_cancel_handler_f(dispatch_source_t source,
00359        dispatch_function_t cancel_handler);
00360 
00383 void
00384 dispatch_source_cancel(dispatch_source_t source);
00385 
00399 long
00400 dispatch_source_testcancel(dispatch_source_t source);
00401 
00426 uintptr_t
00427 dispatch_source_get_handle(dispatch_source_t source);
00428 
00453 unsigned long
00454 dispatch_source_get_mask(dispatch_source_t source);
00455 
00487 unsigned long
00488 dispatch_source_get_data(dispatch_source_t source);
00489 
00506 void
00507 dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
00508 
00540 void
00541 dispatch_source_set_timer(dispatch_source_t source,
00542        dispatch_time_t start,
00543        uint64_t interval,
00544        uint64_t leeway);
00545 
00546 __DISPATCH_END_DECLS
00547 
00548 #endif

Generated on Wed Feb 22 2012 19:43:56 for libXDispatch by Doxygen 1.7.4
Content © 2011-2012 MLBA (about | privacy) – Design © 2010-2012 Emzeat. All Rights reserved.