]> git.lyx.org Git - lyx.git/blob - src/support/mutex.h
Adjust debug output for fonts
[lyx.git] / src / support / mutex.h
1 // -*- C++ -*-
2 /**
3  * \file mutex.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Peter Kümmel
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  * A collection of string helper functions that works with string.
12  * Some of these would certainly benefit from a rewrite/optimization.
13  */
14
15 #ifndef MUTEX_H
16 #define MUTEX_H
17
18
19 namespace lyx {
20
21
22 class Mutex
23 {
24         /// noncopyable
25         Mutex(const Mutex&);
26         Mutex& operator=(const Mutex&);
27 public:
28         Mutex();
29         ~Mutex();
30
31         /// Scope based locking:
32         /// Usage:
33         /// >>> unlocked
34         /// {
35         ///     Mutex::Locker locker(a_Mutex_ptr);
36         ///     >>> locked
37         /// }
38         /// >>> unlocked
39         class Locker
40         {
41         public:
42                 Locker(Mutex*);
43                 ~Locker();
44
45         private:
46                 Locker();
47                 Locker(const Locker& rhs);
48                 Locker& operator=(const Locker& rhs);
49                 Mutex* mutex_;
50         };
51
52 private:
53         struct Private;
54         Private* d;
55 };
56
57
58 } // namespace lyx
59
60 #endif