2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2006 Grame
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __JackPosixThread__
22 #define __JackPosixThread__
24 #include "JackThread.h"
31 \brief The POSIX thread base class.
34 class JackPosixThread
: public JackThread
40 static void* ThreadHandler(void* arg
);
44 JackPosixThread(JackRunnableInterface
* runnable
, bool real_time
, int priority
, int cancellation
)
45 : JackThread(runnable
, priority
, real_time
, cancellation
), fThread((pthread_t
)NULL
)
47 JackPosixThread(JackRunnableInterface
* runnable
)
48 : JackThread(runnable
, 0, false, PTHREAD_CANCEL_DEFERRED
), fThread((pthread_t
)NULL
)
50 JackPosixThread(JackRunnableInterface
* runnable
, int cancellation
)
51 : JackThread(runnable
, 0, false, cancellation
), fThread((pthread_t
)NULL
)
54 virtual ~JackPosixThread()
58 virtual int StartSync();
62 virtual int AcquireRealTime();
63 virtual int AcquireRealTime(int priority
);
64 virtual int DropRealTime();
66 pthread_t
GetThreadID();
68 static int AcquireRealTimeImp(pthread_t thread
, int priority
);
69 static int DropRealTimeImp(pthread_t thread
);
70 static int StartImp(pthread_t
* thread
, int priority
, int realtime
, void*(*start_routine
)(void*), void* arg
);