summaryrefslogtreecommitdiff
path: root/lib/DecoderWorkerLock.hpp
blob: c5b4e0aba8f3cac60df10488205d4cd1ceb9aefd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef WSJTX_DECODER_WORKER_LOCK_HPP
#define WSJTX_DECODER_WORKER_LOCK_HPP

#include <string>

class DecoderWorkerLock final
{
public:
  explicit DecoderWorkerLock (char const * path) noexcept;
  ~DecoderWorkerLock ();
  DecoderWorkerLock (DecoderWorkerLock const&) = delete;
  DecoderWorkerLock& operator= (DecoderWorkerLock const&) = delete;

  bool tryLock () noexcept;
  bool busy () const noexcept;
  std::string errorString () const;

private:
  int descriptor_ {-1};
  int error_ {0};
};

#endif