KDBusAddons 5.109.0
kdbusinterprocesslock.h
1/*
2 This file is part of libkdbus
3
4 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
5 SPDX-FileCopyrightText: 2011 Kevin Ottens <ervin@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#ifndef KDBUSINTERPROCESSLOCK_H
11#define KDBUSINTERPROCESSLOCK_H
12
13#include <QObject>
14#include <memory>
15
16#include <kdbusaddons_export.h>
17
18class KDBusInterProcessLockPrivate;
19
51class KDBUSADDONS_EXPORT KDBusInterProcessLock : public QObject
52{
53 Q_OBJECT
54
55public:
64 KDBusInterProcessLock(const QString &resource);
65
70
74 QString resource() const;
75
81 void lock();
82
89 void unlock();
90
95
96Q_SIGNALS:
103
104private:
105 friend class KDBusInterProcessLockPrivate;
106 std::unique_ptr<KDBusInterProcessLockPrivate> const d;
107};
108
109#endif
A class for serializing access to a resource that is shared between multiple processes.
Definition kdbusinterprocesslock.h:52
void waitForLockGranted()
Waits for the granting of a lock by starting an internal event loop.
void lock()
Requests the lock.
~KDBusInterProcessLock() override
Destroys the inter process lock object.
QString resource() const
Returns the identifier of the resource the lock is set on.
KDBusInterProcessLock(const QString &resource)
Creates a new inter process lock object.
void lockGranted(KDBusInterProcessLock *lock)
This signal is emitted when the requested lock has been granted.
void unlock()
Releases the lock.