aboutsummaryrefslogtreecommitdiff
path: root/src/device/device.hpp
diff options
context:
space:
mode:
authorcslashm <cslashm@gmail.com>2018-03-26 12:38:38 +0200
committercslashm <cslashm@gmail.com>2018-03-31 18:00:33 +0200
commit100b7bc10dcb83f81d6bbd37eca1c8708c4dfbb6 (patch)
treede26f5d5de0f90bc98bb78c66642b5ded53e5faa /src/device/device.hpp
parentAutomatic height setup when creating/restoring hw device. (diff)
downloadmonero-100b7bc10dcb83f81d6bbd37eca1c8708c4dfbb6.tar.xz
Change mutex lock model to avoid dead lock and ensure locks are always released.
Additional cosmetic fixes: move 'name' as protected remove unnecessary local var Fix debug log
Diffstat (limited to '')
-rw-r--r--src/device/device.hpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/device/device.hpp b/src/device/device.hpp
index b47460472..dee191234 100644
--- a/src/device/device.hpp
+++ b/src/device/device.hpp
@@ -78,8 +78,10 @@ namespace hw {
return false;
}
-
class device {
+ protected:
+ std::string name;
+
public:
device() {}
@@ -92,8 +94,6 @@ namespace hw {
static const int SIGNATURE_FAKE = 1;
- std::string name;
-
/* ======================================================================= */
/* SETUP/TEARDOWN */
/* ======================================================================= */
@@ -104,7 +104,15 @@ namespace hw {
virtual bool release() = 0;
virtual bool connect(void) = 0;
- virtual bool disconnect() = 0;
+ virtual bool disconnect(void) = 0;
+
+ /* ======================================================================= */
+ /* LOCKER */
+ /* ======================================================================= */
+ virtual void lock(void) = 0;
+ virtual void unlock(void) = 0;
+ virtual bool try_lock(void) = 0;
+
/* ======================================================================= */
/* WALLET & ADDRESS */