RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mutex.h
Go to the documentation of this file.
1 /*
2  The Real-Time eXperiment Interface (RTXI)
3  Copyright (C) 2011 Georgia Institute of Technology, University of Utah, Weill Cornell Medical College
4 
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 3 of the License, or
8  (at your option) any later version.
9 
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.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #ifndef MUTEX_H
21 #define MUTEX_H
22 
23 #include <pthread.h>
24 
28 class Mutex
29 {
30 
31 public:
32 
36  class Locker
37  {
38 
39  public:
40 
44  Locker(Mutex *m);
45  ~Locker(void);
46 
47  private:
48 
50 
51  };
52 
56  enum type_t
57  {
60  };
61 
65  Mutex(type_t type =FAST);
66  ~Mutex(void);
67 
71  void lock(void);
72 
76  void unlock(void);
77 
81  bool tryLock(void);
82 
83 private:
84 
85  pthread_mutex_t mutex;
86 
87 }; // class Mutex
88 
89 #endif // MUTEX_H
Locker(Mutex *m)
Definition: mutex.cpp:23
~Mutex(void)
Definition: mutex.cpp:53
void unlock(void)
Definition: mutex.cpp:74
~Locker(void)
Definition: mutex.cpp:29
type_t
Definition: mutex.h:56
Definition: mutex.h:28
pthread_mutex_t mutex
Definition: mutex.h:85
void lock(void)
Definition: mutex.cpp:58
Mutex(type_t type=FAST)
Definition: mutex.cpp:35
bool tryLock(void)
Definition: mutex.cpp:79
Mutex * mutex
Definition: mutex.h:49