Move MIDI common files in server library on OSX.
[jack2.git] / windows / JackWinThread.h
blob6861b6fc4b3a7c52557784bf3b5e7559d695b6d4
1 /*
2 Copyright (C) 2004-2008 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef __JackWinThread__
23 #define __JackWinThread__
25 #include "JackThread.h"
26 #include "JackCompilerDeps.h"
27 #include "JackSystemDeps.h"
28 #include <windows.h>
30 namespace Jack
33 typedef DWORD (WINAPI *ThreadCallback)(void *arg);
35 /*!
36 \brief Windows threads.
39 class SERVER_EXPORT JackWinThread : public detail::JackThreadInterface
42 private:
44 HANDLE fThread;
45 HANDLE fEvent;
47 static DWORD WINAPI ThreadHandler(void* arg);
49 public:
51 JackWinThread(JackRunnableInterface* runnable);
52 ~JackWinThread();
54 int Start();
55 int StartSync();
56 int Kill();
57 int Stop();
58 void Terminate();
60 int AcquireRealTime(); // Used when called from another thread
61 int AcquireSelfRealTime(); // Used when called from thread itself
63 int AcquireRealTime(int priority); // Used when called from another thread
64 int AcquireSelfRealTime(int priority); // Used when called from thread itself
66 int DropRealTime(); // Used when called from another thread
67 int DropSelfRealTime(); // Used when called from thread itself
69 jack_native_thread_t GetThreadID();
70 bool IsThread();
72 static int AcquireRealTimeImp(jack_native_thread_t thread, int priority);
73 static int AcquireRealTimeImp(jack_native_thread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
75 return JackWinThread::AcquireRealTimeImp(thread, priority);
77 static int DropRealTimeImp(jack_native_thread_t thread);
78 static int StartImp(jack_native_thread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg)
80 return JackWinThread::StartImp(thread, priority, realtime, (ThreadCallback) start_routine, arg);
82 static int StartImp(jack_native_thread_t* thread, int priority, int realtime, ThreadCallback start_routine, void* arg);
83 static int StopImp(jack_native_thread_t thread);
84 static int KillImp(jack_native_thread_t thread);
88 SERVER_EXPORT void ThreadExit();
90 } // end of namespace
92 #endif