XDispatch 0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
base.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
00003  *
00004  * @APPLE_APACHE_LICENSE_HEADER_START@
00005  * 
00006  * Licensed under the Apache License, Version 2.0 (the "License");
00007  * you may not use this file except in compliance with the License.
00008  * You may obtain a copy of the License at
00009  * 
00010  *     http://www.apache.org/licenses/LICENSE-2.0
00011  * 
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  * 
00018  * @APPLE_APACHE_LICENSE_HEADER_END@
00019  */
00020 
00021 #ifndef __DISPATCH_BASE__
00022 #define __DISPATCH_BASE__
00023 
00029 #ifndef __DISPATCH_INDIRECT__
00030 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
00031 #endif
00032 
00033 #if defined(__cplusplus) && !defined(_MSC_VER)
00034 /*
00035  * Dispatch objects are NOT C++ objects. Nevertheless, we can at least keep C++
00036  * aware of type compatibility.
00037  */
00038 typedef struct dispatch_object_s {
00039 private:
00040        dispatch_object_s();
00041        ~dispatch_object_s();
00042        dispatch_object_s(const dispatch_object_s &);
00043        void operator=(const dispatch_object_s &);
00044 } *dispatch_object_t;
00045 #else
00046 # ifdef __GNUC__
00047 typedef union {
00048     struct dispatch_object_s *_do;
00049     struct dispatch_continuation_s *_dc;
00050     struct dispatch_queue_s *_dq;
00051     struct dispatch_queue_attr_s *_dqa;
00052     struct dispatch_group_s *_dg;
00053     struct dispatch_source_s *_ds;
00054     struct dispatch_source_attr_s *_dsa;
00055     struct dispatch_semaphore_s *_dsema;
00056 } dispatch_object_t __attribute__((transparent_union));
00057 # else /* __GNUC__ */
00058 // this is really really ugly but
00059 // there is no transparent union in MSVC
00060 struct dispatch_object_s;
00061 typedef void* dispatch_object_t;
00062 #endif /* __GNUC__ */
00063 #endif
00064 
00065 typedef void (*dispatch_function_t)(void *);
00066 
00067 #if defined(__cplusplus) && !defined(_MSC_VER)
00068 #define DISPATCH_DECL(name) typedef struct name##_s : public dispatch_object_s {} *name##_t
00069 #else
00070 
00071 #define DISPATCH_DECL(name) typedef struct name##_s *name##_t
00072 #endif
00073 
00074 #ifndef DISPATCH_EXPORT
00075 # ifdef _WIN32
00076 #  ifdef DISPATCH_MAKEDLL
00077 #   define DISPATCH_EXPORT __declspec(dllexport)
00078 #  else
00079 #   define DISPATCH_EXPORT __declspec(dllimport)
00080 #  endif
00081 # else
00082 #  define DISPATCH_EXPORT __attribute__((visibility("default")))
00083 # endif
00084 #endif
00085 
00086 #ifndef DISPATCH_EXTERN
00087 # ifdef _WIN32
00088 #  define DISPATCH_EXTERN
00089 # else
00090 #  define DISPATCH_EXTERN extern
00091 # endif
00092 #endif
00093 
00094 
00097 #endif
00098 

Generated on Tue Jun 12 2012 14:11:47 for XDispatch by Doxygen 1.8.0
© 2010-2012 MLBA (about | privacy) All Rights reserved.