lyx_mirror/src/support/mutex.h
Peter Kümmel 06f26e85df Fix crash on Windows:
1. open LYX
2. CRTL-N
3. CRTL-D hold D --> crash

Graph must be thread save to fix this.

And for sure, we need a mutex also later.

Mutex is a simple wrapper around QMutex, with
pseudo-value semantic.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37222 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-15 21:06:28 +00:00

64 lines
1000 B
C++

// -*- C++ -*-
/**
* \file mutex.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Peter Kümmel
*
* Full author contact details are available in file CREDITS.
*
* A collection of string helper functions that works with string.
* Some of these would certainly benefit from a rewrite/optimization.
*/
#ifndef MUTEX_H
#define MUTEX_H
namespace lyx {
class Mutex
{
public:
Mutex();
~Mutex();
/// Scope based locking:
/// Usage:
/// >>> unlocked
/// {
/// Mutex::Locker locker(a_Mutex_ptr);
/// >>> locked
/// }
/// >>> unlocked
class Locker
{
public:
Locker(Mutex*);
~Locker();
private:
Locker();
Locker(const Locker& rhs);
Locker& operator=(const Locker& rhs);
Mutex* mutex_;
};
// pseude-value semantic
// needed by GuiPrefs which makes a copy
Mutex(const Mutex&);
Mutex& operator=(const Mutex&);
private:
struct Private;
Private* d;
};
} // namespace lyx
#endif