OGLplus  (0.59.0) a C++ wrapper for rendering APIs

process.hpp
Go to the documentation of this file.
1 #ifndef EAGINE_PROCESS_HPP
9 #define EAGINE_PROCESS_HPP
10 
11 #include "config/platform.hpp"
12 #include "identifier_t.hpp"
13 #include "integer_hash.hpp"
14 #include <chrono>
15 #include <cstdint>
16 
17 #if EAGINE_POSIX
18 #include <sys/types.h>
19 #include <unistd.h>
20 #endif
21 
22 namespace eagine {
23 //------------------------------------------------------------------------------
24 static inline auto make_process_instance_id() -> process_instance_id_t {
25  return
26 #if EAGINE_POSIX
27  integer_hash<process_instance_id_t>(::getpid()) ^
28 #endif
29  integer_hash<process_instance_id_t>(
30  std::chrono::steady_clock::now().time_since_epoch().count());
31 }
32 //------------------------------------------------------------------------------
33 } // namespace eagine
34 
35 #endif // EAGINE_PROCESS_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21
std::uint32_t process_instance_id_t
Unique process identifier type (does not necessarily match to OS PID).
Definition: identifier_t.hpp:22

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).