Added mutex to door.cpp to prevent lock collissions
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
368a22b9b1
commit
026d2bdd10
|
@ -39,6 +39,8 @@ Door::State Door::state() const
|
|||
|
||||
void Door::lock()
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_mutex);
|
||||
|
||||
_l(LogLevel::notice, "Executing Pre Lock Script");
|
||||
system(PRE_LOCK_SCRIPT);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
|
@ -52,6 +53,9 @@ private:
|
|||
// Read by the Heartbeat thread if it should klacker the schnapper or not
|
||||
bool _schnapper = { false };
|
||||
|
||||
// Mutex to avoid concurrent locks
|
||||
std::mutex _mutex = { };
|
||||
|
||||
// WiringPi GPIO Pins
|
||||
static constexpr int _HEARTBEATPIN = 10;
|
||||
static constexpr int _SCHNAPPERPIN = 7;
|
||||
|
|
Loading…
Reference in New Issue