]> git.sesse.net Git - vlc/blob - atmo/AtmoThread.h
Merge branch 'master' into lpcm_encoder
[vlc] / atmo / AtmoThread.h
1 /*
2  * AtmoThread.h: Base thread class for all threads inside AtmoWin
3  *
4  *
5  * See the README.txt file for copyright information and how to reach the author(s).
6  *
7  * $Id$
8  */
9 #ifndef _AtmoThread_h_
10 #define _AtmoThread_h_
11
12 #include "AtmoDefs.h"
13
14 #if defined(_ATMO_VLC_PLUGIN_)
15 // use threading stuff from videolan!
16 #   include <vlc/vlc.h>
17 #   include <vlc_threads_funcs.h>
18 #   include <vlc_threads.h>
19
20     typedef struct
21     {
22       VLC_COMMON_MEMBERS
23       void *p_thread; /* cast to CThread * */
24     } atmo_thread_t;
25
26 #else
27 #   include <windows.h>
28 #endif
29
30 class CThread
31 {
32 protected:
33
34 #if defined(_ATMO_VLC_PLUGIN_)
35
36     atmo_thread_t *m_pAtmoThread;
37     vlc_mutex_t  m_TerminateLock;
38     vlc_cond_t   m_TerminateCond;
39     vlc_object_t *m_pOwner;
40
41 #else
42
43     HANDLE m_hThread;
44         DWORD m_dwThreadID;
45         HANDLE m_hTerminateEvent;
46
47 #endif
48
49     volatile ATMO_BOOL m_bTerminated;
50
51 private:
52
53 #if defined(_ATMO_VLC_PLUGIN_)
54     static void ThreadProc(atmo_thread_t *pAtmoThread);
55 #else
56         static DWORD WINAPI ThreadProc(LPVOID lpParameter);
57 #endif
58
59 protected:
60         virtual DWORD Execute(void);
61         ATMO_BOOL ThreadSleep(DWORD millisekunden);
62
63 public:
64 #if defined(_ATMO_VLC_PLUGIN_)
65         CThread(vlc_object_t *pOwner);
66 #else
67         CThread(void);
68 #endif
69
70     virtual ~CThread(void);
71
72     void Terminate(void);
73     void Run();
74
75 };
76
77 #endif
78