00001 /* 00002 * AtmoThread.h: Base thread class for all threads inside AtmoWin 00003 * 00004 * 00005 * See the README.txt file for copyright information and how to reach the author(s). 00006 * 00007 * $Id$ 00008 */ 00009 #ifndef _AtmoThread_h_ 00010 #define _AtmoThread_h_ 00011 00012 #include "AtmoDefs.h" 00013 00014 #if defined(_ATMO_VLC_PLUGIN_) 00015 // use threading stuff from videolan! 00016 # include <vlc_common.h> 00017 # include <vlc_threads.h> 00018 00019 typedef struct 00020 { 00021 VLC_COMMON_MEMBERS 00022 void *p_thread; /* cast to CThread * */ 00023 } atmo_thread_t; 00024 00025 #else 00026 # include <windows.h> 00027 #endif 00028 00029 class CThread 00030 { 00031 protected: 00032 00033 #if defined(_ATMO_VLC_PLUGIN_) 00034 00035 atmo_thread_t *m_pAtmoThread; 00036 vlc_mutex_t m_TerminateLock; 00037 vlc_cond_t m_TerminateCond; 00038 vlc_object_t *m_pOwner; 00039 00040 #else 00041 00042 HANDLE m_hThread; 00043 DWORD m_dwThreadID; 00044 HANDLE m_hTerminateEvent; 00045 00046 #endif 00047 00048 volatile ATMO_BOOL m_bTerminated; 00049 00050 private: 00051 00052 #if defined(_ATMO_VLC_PLUGIN_) 00053 static void *ThreadProc(vlc_object_t *); 00054 #else 00055 static DWORD WINAPI ThreadProc(LPVOID lpParameter); 00056 #endif 00057 00058 protected: 00059 virtual DWORD Execute(void); 00060 ATMO_BOOL ThreadSleep(DWORD millisekunden); 00061 00062 public: 00063 #if defined(_ATMO_VLC_PLUGIN_) 00064 CThread(vlc_object_t *pOwner); 00065 #else 00066 CThread(void); 00067 #endif 00068 00069 virtual ~CThread(void); 00070 00071 void Terminate(void); 00072 void Run(); 00073 00074 }; 00075 00076 #endif 00077
1.5.6