MiKTeX 23.10-next
A scalable TeX distribution
Loading...
Searching...
No Matches
LockFile.h
1/* miktex/Core/LockFile.h: -*- C++ -*-
2
3 Copyright (C) 2018-2021 Christian Schenk
4
5 This file is part of the MiKTeX Core Library.
6
7 The MiKTeX Core Library is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2, or
10 (at your option) any later version.
11
12 The MiKTeX Core Library is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with the MiKTeX Core Library; if not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22#pragma once
23
24#if !defined(AC4770A4B46740C1A3C4AEA7DB977164)
25#define AC4770A4B46740C1A3C4AEA7DB977164
26
27#include <miktex/Core/config.h>
28
29#include <cstddef>
30
31#include <chrono>
32#include <memory>
33
34#include <miktex/Util/PathName>
35
36MIKTEX_CORE_BEGIN_NAMESPACE;
37
39class MIKTEXNOVTABLE LockFile
40{
41public:
42 virtual MIKTEXTHISCALL ~LockFile() noexcept = 0;
43
47public:
48 virtual bool MIKTEXTHISCALL TryLock(std::chrono::milliseconds timeout) = 0;
49
51public:
52 virtual void MIKTEXTHISCALL Unlock() = 0;
53
57public:
58 static MIKTEXCORECEEAPI(std::unique_ptr<LockFile>) Create(const MiKTeX::Util::PathName& path);
59};
60
61MIKTEX_CORE_END_NAMESPACE;
62
63#endif
An instance of this class provides an interface to a lock file.
Definition: LockFile.h:40
static std::unique_ptr< LockFile > Create(const MiKTeX::Util::PathName &path)
virtual bool TryLock(std::chrono::milliseconds timeout)=0
virtual void Unlock()=0
Removes the lock file.
Instances of this class can be used to store path names.
Definition: PathName.h:73