From 90e626b52c75e9e117494f15f57177aaf912468c Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 13 Jan 2017 10:43:15 +0100 Subject: Add lock_guard for complete send-receive cycle Signed-off-by: Szczepan Zalega --- include/device_proto.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/device_proto.h b/include/device_proto.h index 667b8db..31bfe11 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -32,6 +32,8 @@ #define PWS_SEND_TAB 2 #define PWS_SEND_CR 3 +#include + namespace nitrokey { namespace proto { /* @@ -204,13 +206,15 @@ namespace nitrokey { bzero(&st, sizeof(st)); } - static ClearingProxy run(device::Device &dev, const command_payload &payload) { using namespace ::nitrokey::device; using namespace ::nitrokey::log; using namespace std::chrono_literals; + static std::mutex send_receive_mtx; + std::lock_guard guard(send_receive_mtx); + Log::instance()(__PRETTY_FUNCTION__, Loglevel::DEBUG_L2); int status; -- cgit v1.2.3