JackPosixThread.h

00001 /*
00002 Copyright (C) 2001 Paul Davis
00003 Copyright (C) 2004-2006 Grame
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 */
00020 
00021 #ifndef __JackPosixThread__
00022 #define __JackPosixThread__
00023 
00024 #include "JackThread.h"
00025 #include <pthread.h>
00026 
00027 namespace Jack
00028 {
00029 
00034 class JackPosixThread : public JackThread
00035 {
00036 
00037     protected:
00038 
00039         pthread_t fThread;
00040 
00041         static void* ThreadHandler(void* arg);
00042 
00043     public:
00044 
00045         JackPosixThread(JackRunnableInterface* runnable, bool real_time, int priority, int cancellation)
00046                 : JackThread(runnable, priority, real_time, cancellation), fThread((pthread_t)NULL)
00047         {}
00048         JackPosixThread(JackRunnableInterface* runnable)
00049                 : JackThread(runnable, 0, false, PTHREAD_CANCEL_DEFERRED), fThread((pthread_t)NULL)
00050         {}
00051         JackPosixThread(JackRunnableInterface* runnable, int cancellation)
00052                 : JackThread(runnable, 0, false, cancellation), fThread((pthread_t)NULL)
00053         {}
00054 
00055         virtual ~JackPosixThread()
00056         {}
00057 
00058         virtual int Start();
00059         virtual int StartSync();
00060         virtual int Kill();
00061         virtual int Stop();
00062 
00063         virtual int AcquireRealTime();
00064         virtual int AcquireRealTime(int priority);
00065         virtual int DropRealTime();
00066 
00067         pthread_t GetThreadID();
00068 };
00069 
00070 } // end of namespace
00071 
00072 
00073 #endif

Generated on Wed Jan 10 11:42:46 2007 for Jackdmp by  doxygen 1.4.5