summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorShantanu Tushar <shantanu.tushar@kdab.com>2020-10-16 17:09:44 +0200
committerShantanu Tushar <shantanu.tushar@kdab.com>2020-10-18 20:16:38 +0200
commit927cd268aac8e1a97a127f63b9dd83e831c8b642 (patch)
tree1f146319bf12d4ca462e953c82e79ea27d0d45b7 /src/corelib
parent9402a351dd1f37d595660010c7a55a7c8fb5e668 (diff)
Add function to access QLockFile's file name
This is useful in cases like error handling when you need to print the name of the lock file. Change-Id: Ife4901ed53ae81d19e68cce7f1c173ef3745d56f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qlockfile.cpp8
-rw-r--r--src/corelib/io/qlockfile.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp
index aa84ce6bc1..ba2dc28339 100644
--- a/src/corelib/io/qlockfile.cpp
+++ b/src/corelib/io/qlockfile.cpp
@@ -151,6 +151,14 @@ QLockFile::~QLockFile()
}
/*!
+ * Returns the file name of the lock file
+ */
+QString QLockFile::fileName() const
+{
+ return d_ptr->fileName;
+}
+
+/*!
Sets \a staleLockTime to be the time in milliseconds after which
a lock file is considered stale.
The default value is 30000, i.e. 30 seconds.
diff --git a/src/corelib/io/qlockfile.h b/src/corelib/io/qlockfile.h
index 8b94900901..ba955241b6 100644
--- a/src/corelib/io/qlockfile.h
+++ b/src/corelib/io/qlockfile.h
@@ -53,6 +53,8 @@ public:
QLockFile(const QString &fileName);
~QLockFile();
+ QString fileName() const;
+
bool lock();
bool tryLock(int timeout = 0);
void unlock();