aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-06-21 17:19:16 +0900
committerstoffu <stoffu@protonmail.ch>2018-06-28 09:40:31 +0900
commit59de6f8d99f07888c199b466dff9ff020e60dab6 (patch)
tree15e136f2cbeadda054ca14e6514bd0d8ccb5cd4e /src/common/util.h
parentepee.string_tools: add conversion between UTF-8 and UTF-16 (diff)
downloadmonero-59de6f8d99f07888c199b466dff9ff020e60dab6.tar.xz
util: add file_locker class
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h
index dc426830b..a57a85fee 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -91,6 +91,20 @@ namespace tools
const std::string& filename() const noexcept { return m_filename; }
};
+ class file_locker
+ {
+ public:
+ file_locker(const std::string &filename);
+ ~file_locker();
+ bool locked() const;
+ private:
+#ifdef WIN32
+ HANDLE m_fd;
+#else
+ int m_fd;
+#endif
+ };
+
/*! \brief Returns the default data directory.
*
* \details Windows < Vista: C:\\Documents and Settings\\Username\\Application Data\\CRYPTONOTE_NAME