Logo white

Peter M. Groen / FlashMQ

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • FlashMQ
  • oneinstancelock.h
  • Only allow one instance (per user) to run
    38563f95
    Wiebe Cazemier authored
    2021-03-20 19:02:25 +0100  
    Browse Code ยป
oneinstancelock.h 390 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#ifndef ONEINSTANCELOCK_H
#define ONEINSTANCELOCK_H

#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <string>
#include "logger.h"

class OneInstanceLock
{
    int fd = -1;
    std::string lockFilePath;
    Logger *logger = Logger::getInstance();

public:
    OneInstanceLock();
    ~OneInstanceLock();
    void lock();
    void unlock();
};

#endif // ONEINSTANCELOCK_H