Locks a Tox profile so that multiple instances can not use the same profile. Only one lock can be acquired at the same time, which means that there is little need for manually unlocking. The current lock will expire if you exit or acquire a new one.
More...
#include <profilelocker.h>
|
static bool | isLockable (QString profile) |
| Checks if a profile is currently locked by another instance. If we own the lock, we consider it lockable. There is no guarantee that the result will still be valid by the time it is returned, this is provided on a best effort basis. More...
|
|
static bool | lock (QString profile) |
| Tries to acquire the lock on a profile, will not block. More...
|
|
static void | unlock () |
| Releases the lock on the current profile. More...
|
|
static bool | hasLock () |
| Chacks, that profile locked. More...
|
|
static QString | getCurLockName () |
| Get current locked profile name. More...
|
|
static void | assertLock () |
| Check that we actually own the lock. In case the file was deleted on disk, restore it. If we can't get a lock, exit qTox immediately. If we never had a lock in the first place, exit immediately. More...
|
|
Locks a Tox profile so that multiple instances can not use the same profile. Only one lock can be acquired at the same time, which means that there is little need for manually unlocking. The current lock will expire if you exit or acquire a new one.
Definition at line 26 of file profilelocker.h.
◆ ProfileLocker()
ProfileLocker::ProfileLocker |
( |
| ) |
|
|
privatedelete |
◆ assertLock()
void ProfileLocker::assertLock |
( |
| ) |
|
|
static |
Check that we actually own the lock. In case the file was deleted on disk, restore it. If we can't get a lock, exit qTox immediately. If we never had a lock in the first place, exit immediately.
Definition at line 104 of file profilelocker.cpp.
◆ deathByBrokenLock()
void ProfileLocker::deathByBrokenLock |
( |
| ) |
|
|
staticprivate |
◆ getCurLockName()
QString ProfileLocker::getCurLockName |
( |
| ) |
|
|
static |
Get current locked profile name.
- Returns
- Return the name of the currently loaded profile, a null string if there is none.
Definition at line 145 of file profilelocker.cpp.
◆ hasLock()
bool ProfileLocker::hasLock |
( |
| ) |
|
|
static |
Chacks, that profile locked.
- Returns
- Returns true if we're currently holding a lock.
Definition at line 136 of file profilelocker.cpp.
◆ isLockable()
bool ProfileLocker::isLockable |
( |
QString |
profile | ) |
|
|
static |
Checks if a profile is currently locked by another instance. If we own the lock, we consider it lockable. There is no guarantee that the result will still be valid by the time it is returned, this is provided on a best effort basis.
- Parameters
-
- Returns
- True, if profile locked, false otherwise.
Definition at line 52 of file profilelocker.cpp.
◆ lock()
bool ProfileLocker::lock |
( |
QString |
profile | ) |
|
|
static |
Tries to acquire the lock on a profile, will not block.
- Parameters
-
- Returns
- Returns true if we already own the lock.
Definition at line 67 of file profilelocker.cpp.
◆ lockPathFromName()
QString ProfileLocker::lockPathFromName |
( |
const QString & |
name | ) |
|
|
staticprivate |
◆ unlock()
void ProfileLocker::unlock |
( |
| ) |
|
|
static |
◆ curLockName
QString ProfileLocker::curLockName |
|
staticprivate |
◆ lockfile
unique_ptr< QLockFile > ProfileLocker::lockfile |
|
staticprivate |
The documentation for this class was generated from the following files: