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

Revision 1254, 1.5 kB (checked in by ppalmers, 14 years ago)

split config.h into config/version/debug_config to allow for faster compilation (splits dependencies)

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef __POSIX_MUTEX__
25 #define __POSIX_MUTEX__
26
27
28
29 #include "Mutex.h"
30 #include <pthread.h>
31
32 #include "debugmodule/debugmodule.h"
33
34 namespace Util
35 {
36
37 /**
38  * @brief The POSIX mutex implementation.
39  */
40
41 class PosixMutex : public Mutex
42 {
43 public:
44     PosixMutex();
45     virtual ~PosixMutex();
46
47     virtual void Lock();
48     virtual bool TryLock();
49     virtual void Unlock();
50
51     virtual bool isLocked();
52
53     virtual void show();
54     virtual void setVerboseLevel(int l) {setDebugLevel(l);};
55
56 protected:
57     DECLARE_DEBUG_MODULE;
58
59 private:
60     pthread_mutex_t m_mutex;
61
62     #if DEBUG_LOCK_COLLISION_TRACING
63     void *m_locked_by;
64     #endif
65 };
66
67 } // end of namespace
68
69 #endif
Note: See TracBrowser for help on using the browser.