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 #ifndef __DISPATCH_BASE__
00023 #define __DISPATCH_BASE__
00024
00025 #ifndef __DISPATCH_INDIRECT__
00026 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00027 #endif
00028
00029 typedef void (*dispatch_function_t)(void *);
00030
00031 #ifndef ATOMIC_INT
00032
00033 #ifdef __GNUC__
00034 # define ATOMIC_INT unsigned int
00035 #endif
00036 #ifdef _MSC_VER
00037 # if _MSC_VER >= 1600
00038 # define ATOMIC_INT unsigned int
00039 # else
00040 # define ATOMIC_INT long
00041 # endif
00042 #endif
00043
00044 #endif
00045
00046 #ifndef DISPATCH_EXPORT
00047 # if __GNUC__
00048 # define DISPATCH_EXPORT __attribute__((visibility("default")))
00049 # elif _WIN32
00050 # define DISPATCH_EXPORT __declspec(dllexport)
00051 # else
00052 # define DISPATCH_EXPORT
00053 # endif
00054 #endif
00055
00056 #ifdef __cplusplus
00057
00058
00059
00060
00061 typedef struct dispatch_object_s {
00062 public:
00063 void* context;
00064 int type;
00065 unsigned int count;
00066 ATOMIC_INT lock;
00067 dispatch_function_t finalizer;
00068 void* target;
00069 char suspended;
00070 void* obj;
00071 private:
00072 dispatch_object_s();
00073 dispatch_object_s(const dispatch_object_s &);
00074 void operator=(const dispatch_object_s &);
00075 } *dispatch_object_t;
00076 #else
00077 typedef struct dispatch_object_s {
00078 void* context;
00079 int type;
00080 unsigned int count;
00081 ATOMIC_INT lock;
00082 dispatch_function_t finalizer;
00083 void* target;
00084 char suspended;
00085 void* obj;
00086 } *dispatch_object_t;
00087 #endif
00088
00089 #ifdef __cplusplus
00090 # define DISPATCH_DECL(name) typedef struct name##_s : public dispatch_object_s {} *name##_t
00091 #else
00092 # define DISPATCH_DECL(name) typedef struct dispatch_object_s *name##_t
00093 #endif
00094
00095
00096 #endif