source: calamares/trunk/fuentes/src/libcalamares/kdsingleapplicationguard/kdsharedmemorylocker.cpp @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 897 bytes
Line 
1#include "kdsharedmemorylocker.h"
2
3#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN )
4
5#include <QSharedMemory>
6
7using namespace kdtools;
8
9/*!
10  \class KDSharedMemoryLocker
11  \ingroup raii core
12  \brief Exception-safe and convenient wrapper around QSharedMemory::lock()
13*/
14
15/**
16 * Constructor. Locks the shared memory segment \a mem.
17 * If another process has locking the segment, this constructor blocks
18 * until the lock is released. The memory segments needs to be properly created or attached.
19 */
20KDSharedMemoryLocker::KDSharedMemoryLocker( QSharedMemory* mem )
21    : mem( mem )
22{
23    mem->lock();
24}
25
26/**
27 * Destructor. Unlocks the shared memory segment associated with this
28 * KDSharedMemoryLocker.
29 */
30KDSharedMemoryLocker::~KDSharedMemoryLocker()
31{
32    mem->unlock();
33}
34
35#ifdef KDAB_EVAL
36#include KDAB_EVAL
37static const EvalDialogChecker evalChecker( "KD Tools", false );
38#endif
39
40#endif
Note: See TracBrowser for help on using the repository browser.