pstore2
vacuum_intf.hpp
Go to the documentation of this file.
1 //===- include/pstore/core/vacuum_intf.hpp ----------------*- mode: C++ -*-===//
2 //* _ _ __ *
3 //* __ ____ _ ___ _ _ _ _ _ __ ___ (_)_ __ | |_ / _| *
4 //* \ \ / / _` |/ __| | | | | | | '_ ` _ \ | | '_ \| __| |_ *
5 //* \ V / (_| | (__| |_| | |_| | | | | | | | | | | | |_| _| *
6 //* \_/ \__,_|\___|\__,_|\__,_|_| |_| |_| |_|_| |_|\__|_| *
7 //* *
8 //===----------------------------------------------------------------------===//
9 //
10 // Part of the pstore project, under the Apache License v2.0 with LLVM Exceptions.
11 // See https://github.com/SNSystems/pstore/blob/master/LICENSE.txt for license
12 // information.
13 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14 //
15 //===----------------------------------------------------------------------===//
17 
18 #ifndef PSTORE_CORE_VACUUM_INTF_HPP
19 #define PSTORE_CORE_VACUUM_INTF_HPP
20 
21 #include <atomic>
22 #include <cstdint>
23 
24 #include <ctime>
25 
26 #if defined(_WIN32)
27 # define NOMINMAX
28 # define WIN32_LEAN_AND_MEAN
29 # include <Windows.h>
30 #else
31 # include <pthread.h>
32 # include <unistd.h>
33 #endif
34 
35 namespace pstore {
36 
37 #if defined(_WIN32)
38  using pid_t = DWORD;
39 #else
40  using pid_t = ::pid_t;
41 #endif // !defined (_WIN32)
42 
43  struct shared {
44  static constexpr auto not_running = pid_t{0};
45  static constexpr auto starting = static_cast<pid_t> (-1);
46 
47  shared ();
48 
49  std::atomic<pid_t> pid{0};
51  std::atomic<std::uint64_t> start_time{0};
52  std::atomic<std::time_t> time{0};
53 
57  std::atomic<std::uint64_t> open_tick;
58  };
59 
60 } // namespace pstore
61 #endif // PSTORE_CORE_VACUUM_INTF_HPP
Definition: nonpod2.cpp:40
std::atomic< std::uint64_t > start_time
The time at which the process was started, in milliseconds since the epoch.
Definition: vacuum_intf.hpp:51
Definition: vacuum_intf.hpp:43
std::atomic< std::uint64_t > open_tick
A value which is periodically incremented whilst a pstore instance is open on the system...
Definition: vacuum_intf.hpp:57