mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 00:24:12 +02:00
Compile kdsingleapplicationguard as separate lib
This commit is contained in:
40
thirdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp
vendored
Normal file
40
thirdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "kdsharedmemorylocker.h"
|
||||
|
||||
#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN )
|
||||
|
||||
#include <QSharedMemory>
|
||||
|
||||
using namespace kdtools;
|
||||
|
||||
/*!
|
||||
\class KDSharedMemoryLocker
|
||||
\ingroup raii core
|
||||
\brief Exception-safe and convenient wrapper around QSharedMemory::lock()
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructor. Locks the shared memory segment \a mem.
|
||||
* If another process has locking the segment, this constructor blocks
|
||||
* until the lock is released. The memory segments needs to be properly created or attached.
|
||||
*/
|
||||
KDSharedMemoryLocker::KDSharedMemoryLocker( QSharedMemory* mem )
|
||||
: mem( mem )
|
||||
{
|
||||
mem->lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor. Unlocks the shared memory segment associated with this
|
||||
* KDSharedMemoryLocker.
|
||||
*/
|
||||
KDSharedMemoryLocker::~KDSharedMemoryLocker()
|
||||
{
|
||||
mem->unlock();
|
||||
}
|
||||
|
||||
#ifdef KDAB_EVAL
|
||||
#include KDAB_EVAL
|
||||
static const EvalDialogChecker evalChecker( "KD Tools", false );
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user