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 #ifndef __SYNCHRONIZER__
00022 #define __SYNCHRONIZER__
00023
00024 #include <boost/function.hpp>
00025 #include <ut_assert.h>
00026
00027 class Synchronizer;
00028
00029 #ifdef _WIN32
00030
00031 #define WM_ABI_SYNCHRONIZER WM_USER+15
00032 #include <windows.h>
00033 #include <session/xp/AbiCollabSessionManager.h>
00034 #else
00035
00036 #include <unistd.h>
00037 #include <glib.h>
00038 #endif
00039
00040 class Synchronizer
00041 {
00042 public:
00043 #ifdef _WIN32
00044
00045 static bool sm_bClassRegistered;
00046 static int sm_iMessageWindows;
00047
00048 static LRESULT CALLBACK s_wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
00049 static void _registerWndClass();
00050 static void _unregisterWndClass();
00051 #endif
00052
00053
00054 Synchronizer(boost::function<void ()> signalhandler);
00055 virtual ~Synchronizer();
00056
00057 void signal();
00058
00059 void callMainloop()
00060 {
00061 _consume();
00062 m_signalhandler();
00063 }
00064
00065 private:
00066 void _consume();
00067
00069
00071
00072 boost::function<void ()> m_signalhandler;
00073
00074 #ifdef _WIN32
00075 HWND m_hWnd;
00076 bool m_bIsProcessing;
00077 int m_iDeferredMessages;
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 bool* m_bIsDestroyed;
00088 #else
00089 int fdr;
00090 int fdw;
00091 GIOChannel* io_channel;
00092 guint io_channel_watch_id;
00093 #endif
00094 };
00095
00096 #endif