mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-16 07:55:41 +00:00
3e83380350
It is no longer needed, and it had a comment that it needed review... Now anybody who tries to make a copy again is forced to think about it, instead of trying and using possibly wrong semantics by accident.
57 lines
682 B
C++
57 lines
682 B
C++
/**
|
|
* \file mutex.cpp
|
|
* 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.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "mutex.h"
|
|
|
|
#include <QMutex>
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
struct Mutex::Private
|
|
{
|
|
// QMutex::Recursive: less risks for dead-locks
|
|
Private() : qmutex_(QMutex::Recursive)
|
|
{
|
|
}
|
|
|
|
QMutex qmutex_;
|
|
};
|
|
|
|
|
|
Mutex::Mutex() : d(new Private)
|
|
{
|
|
}
|
|
|
|
|
|
Mutex::~Mutex()
|
|
{
|
|
delete d;
|
|
}
|
|
|
|
|
|
Mutex::Locker::Locker(Mutex* mtx) : mutex_(mtx)
|
|
{
|
|
mutex_->d->qmutex_.lock();
|
|
}
|
|
|
|
|
|
Mutex::Locker::~Locker()
|
|
{
|
|
mutex_->d->qmutex_.unlock();
|
|
}
|
|
|
|
|
|
|
|
} // namespace lyx
|