Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 #ifndef XDISPATCH_LAMBDA_DISPATCH_H_
00029 #define XDISPATCH_LAMBDA_DISPATCH_H_
00030 
00036 #ifndef __XDISPATCH_INDIRECT__
00037 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00038 #endif
00039 
00041 
00042 #ifdef __cplusplus
00043 
00044 
00045 void XDISPATCH_EXPORT _xdispatch_source_set_event_handler(dispatch_source_t, xdispatch::operation* op);
00046 void XDISPATCH_EXPORT _xdispatch_source_set_cancel_handler(dispatch_source_t, xdispatch::operation* op);
00047 
00048 #endif
00049 
00050 #if defined(XDISPATCH_HAS_BLOCKS) && !defined(__BLOCKS__)
00051 
00052 inline void dispatch_async(dispatch_queue_t queue, dispatch_block_t block){
00053     xdispatch::queue( queue ).async( block );
00054 }
00055 
00056 inline void dispatch_after(dispatch_time_t when, dispatch_queue_t queue, dispatch_block_t block){
00057     xdispatch::queue( queue ).after( block, when );
00058 }
00059 
00060 inline void dispatch_sync(dispatch_queue_t queue, dispatch_block_t block){
00061     xdispatch::queue( queue ).sync( block );
00062 }
00063 
00064 inline void dispatch_apply(size_t iterations, dispatch_queue_t queue, dispatch_iteration_block_t block){
00065     xdispatch::queue( queue ).apply( block, iterations );
00066 }
00067 
00068 inline void dispatch_group_async(dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block){
00069     xdispatch::group( group ).async( block, queue );
00070 }
00071 
00072 inline void dispatch_group_notify(dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block){
00073     xdispatch::group( group ).notify( block, queue );
00074 }
00075 
00076 inline void dispatch_source_set_event_handler(dispatch_source_t source, dispatch_block_t handler){
00077     _xdispatch_source_set_event_handler( source, new xdispatch::block_operation(handler) );
00078 }
00079 
00080 inline void dispatch_source_set_cancel_handler(dispatch_source_t source, dispatch_block_t cancel_handler){
00081     _xdispatch_source_set_cancel_handler( source, new xdispatch::block_operation(cancel_handler) );
00082 }
00083 
00084 inline void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block){
00085     xdispatch::once o( predicate );
00086     o( block );
00087 }
00088 
00089 #endif
00090 
00093 #endif