diff options
| author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-01-11 16:52:33 +0100 | 
|---|---|---|
| committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:36 +0100 | 
| commit | fc986f87fd256e2cfdd5edcc5b0cf14faf694441 (patch) | |
| tree | 12bb54c1462ffa281efc8ba3ce78fc015cbe5c2c /include | |
| parent | 55745fccf0c4233c536d8bacead3443a8e431b8d (diff) | |
| download | libnitrokey-fc986f87fd256e2cfdd5edcc5b0cf14faf694441.tar.gz libnitrokey-fc986f87fd256e2cfdd5edcc5b0cf14faf694441.tar.bz2 | |
Use atomic_exchange for atomic operations
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/device.h | 4 | 
1 files changed, 1 insertions, 3 deletions
| diff --git a/include/device.h b/include/device.h index 938fc75..42865ee 100644 --- a/include/device.h +++ b/include/device.h @@ -6,8 +6,6 @@  #define HID_REPORT_SIZE 65 -// TODO !! SEMAPHORE -  #include <atomic>  namespace nitrokey { @@ -60,7 +58,7 @@ public:    std::chrono::milliseconds get_retry_timeout() const { return m_retry_timeout; };    std::chrono::milliseconds get_send_receive_delay() const {return m_send_receive_delay;} -  int get_last_command_status() {int a = last_command_status; last_command_status = 0; return a;}; +  int get_last_command_status() {int a = std::atomic_exchange(&last_command_status, static_cast<uint8_t>(0)); return a;};    void set_last_command_status(uint8_t _err) { last_command_status = _err;} ;    bool last_command_sucessfull() const {return last_command_status == 0;};    DeviceModel get_device_model() const {return m_model;} | 
