Add innosetup files
[jack2.git] / android / JackAndroidThread.h
blobd6ec66d8528ffd3d6bcb85e9d1ed290db35a4439
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2008 Grame
4 Copyright (C) 2013 Samsung Electronics
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef __JackAndroidThread__
23 #define __JackAndroidThread__
25 #include "JackThread.h"
26 #include <pthread.h>
28 namespace Jack
31 /* use 512KB stack per thread - the default is way too high to be feasible
32 * with mlockall() on many systems */
33 #define THREAD_STACK 524288
35 enum
37 PTHREAD_CANCEL_DEFERRED,
38 PTHREAD_CANCEL_ASYNCHRONOUS
41 /*!
42 \brief The POSIX thread base class.
45 class SERVER_EXPORT JackAndroidThread : public detail::JackThreadInterface
48 protected:
50 jack_native_thread_t fThread;
51 static void* ThreadHandler(void* arg);
52 static void thread_exit_handler(int sig);
54 public:
56 JackAndroidThread(JackRunnableInterface* runnable, bool real_time, int priority, int cancellation)
57 : JackThreadInterface(runnable, priority, real_time, cancellation), fThread((jack_native_thread_t)NULL)
59 JackAndroidThread(JackRunnableInterface* runnable, int cancellation = PTHREAD_CANCEL_ASYNCHRONOUS)
60 : JackThreadInterface(runnable, 0, false, cancellation), fThread((jack_native_thread_t)NULL)
63 int Start();
64 int StartSync();
65 int Kill();
66 int Stop();
67 void Terminate();
69 int AcquireRealTime(); // Used when called from another thread
70 int AcquireSelfRealTime(); // Used when called from thread itself
72 int AcquireRealTime(int priority); // Used when called from another thread
73 int AcquireSelfRealTime(int priority); // Used when called from thread itself
75 int DropRealTime(); // Used when called from another thread
76 int DropSelfRealTime(); // Used when called from thread itself
78 jack_native_thread_t GetThreadID();
79 bool IsThread();
81 static int AcquireRealTimeImp(jack_native_thread_t thread, int priority);
82 static int AcquireRealTimeImp(jack_native_thread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
84 return JackAndroidThread::AcquireRealTimeImp(thread, priority);
86 static int DropRealTimeImp(jack_native_thread_t thread);
87 static int StartImp(jack_native_thread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg);
88 static int StopImp(jack_native_thread_t thread);
89 static int KillImp(jack_native_thread_t thread);
92 SERVER_EXPORT void ThreadExit();
94 } // end of namespace
97 #endif