root/trunk/libffado/src/libutil/PosixThread.h

Revision 445, 2.3 kB (checked in by pieterpalmers, 14 years ago)

* name change from FreeBoB to FFADO
* replaced tabs by 4 spaces
* got rid of end-of-line spaces
* made all license and copyrights conform

library becomes LGPL, apps become GPL
explicitly state LGPL v2.1 and GPL v2 (don't like v3 draft)

copyrights are 2005-2007 Daniel & Pieter
except for the MotU stuff (C) Jonathan, Pieter

Line 
1 /*
2 Modifications for FFADO by Pieter Palmers
3
4 Copied from the jackd/jackdmp sources
5 function names changed in order to avoid naming problems when using this in
6 a jackd backend.
7
8 Copyright (C) 2001 Paul Davis
9 Copyright (C) 2004-2006 Grame
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
25 */
26
27 #ifndef __FFADO_POSIXTHREAD__
28 #define __FFADO_POSIXTHREAD__
29
30 #include "Thread.h"
31 #include <pthread.h>
32
33 namespace Util
34 {
35
36 /*!
37 \brief The POSIX thread base class.
38 */
39
40 class PosixThread : public Thread
41 {
42
43     protected:
44
45         pthread_t fThread;
46         int fPriority;
47         bool fRealTime;
48         volatile bool fRunning;
49         int fCancellation;
50
51         static void* ThreadHandler(void* arg);
52
53     public:
54
55         PosixThread(RunnableInterface* runnable, bool real_time, int priority, int cancellation)
56                 : Thread(runnable), fThread((pthread_t)NULL), fPriority(priority), fRealTime(real_time), fRunning(false), fCancellation(cancellation)
57         {}
58         PosixThread(RunnableInterface* runnable)
59                 : Thread(runnable), fThread((pthread_t)NULL), fPriority(0), fRealTime(false), fRunning(false), fCancellation(PTHREAD_CANCEL_DEFERRED)
60         {}
61         PosixThread(RunnableInterface* runnable, int cancellation)
62                 : Thread(runnable), fThread((pthread_t)NULL), fPriority(0), fRealTime(false), fRunning(false), fCancellation(cancellation)
63         {}
64
65         virtual ~PosixThread()
66         {}
67
68         virtual int Start();
69         virtual int Kill();
70         virtual int Stop();
71
72         virtual int AcquireRealTime();
73         virtual int AcquireRealTime(int priority);
74         virtual int DropRealTime();
75
76         pthread_t GetThreadID();
77
78     protected:
79
80 };
81
82 } // end of namespace
83
84
85 #endif // __FFADO_POSIXTHREAD__
Note: See TracBrowser for help on using the browser.