10#define TF_OS_DRAGONFLY 0
11#define TF_OS_FREEBSD 0
13#define TF_OS_OPENBSD 0
15#define TF_OS_WINDOWS 0
18#define TF_OS_SOLARIS 0
23#define TF_OS_WINDOWS 1
28#define TF_OS_WINDOWS 1
31#if (defined __APPLE__ && defined __MACH__)
40#elif (defined __linux__)
46#if (defined __DragonFly__)
48#define TF_OS_DRAGONFLY 1
51#if (defined __FreeBSD__)
53#define TF_OS_FREEBSD 1
56#if (defined __NetBSD__)
61#if (defined __OpenBSD__)
63#define TF_OS_OPENBSD 1
78#define TF_OS_SOLARIS 1
82 TF_OS_LINUX + TF_OS_DRAGONFLY + TF_OS_FREEBSD + TF_OS_NETBSD + \
83 TF_OS_OPENBSD + TF_OS_DARWIN + TF_OS_WINDOWS + TF_OS_HURD + \
85#define TF_OS_UNKNOWN 1
88#if TF_OS_LINUX || TF_OS_DRAGONFLY || TF_OS_FREEBSD || TF_OS_NETBSD || \
89 TF_OS_OPENBSD || TF_OS_DARWIN || TF_OS_HURD || TF_OS_SOLARIS
97#if defined(__i386__) || defined(__x86_64__)
98 #define TF_CACHELINE_SIZE 64
99#elif defined(__powerpc64__)
102 #define TF_CACHELINE_SIZE 128
103#elif defined(__arm__)
108 #if defined(__ARM_ARCH_5T__)
109 #define TF_CACHELINE_SIZE 32
110 #elif defined(__ARM_ARCH_7A__)
111 #define TF_CACHELINE_SIZE 64
115#ifndef TF_CACHELINE_SIZE
118 #define TF_CACHELINE_SIZE 64
153 alignas (TF_CACHELINE_SIZE) T
data;
183inline std::string
get_env(
const std::string& str) {
188 if(_dupenv_s(&ptr, &len, str.c_str()) == 0 && ptr !=
nullptr) {
189 std::string res(ptr, len);
196 auto ptr = std::getenv(str.c_str());
197 return ptr ? ptr :
"";
218 if(_dupenv_s(&ptr, &len, str.c_str()) == 0 && ptr !=
nullptr) {
219 std::string res(ptr, len);
226 auto ptr = std::getenv(str.c_str());
227 return ptr ? true :
false;
class to ensure cacheline-aligned storage for an object.
Definition os.hpp:148
T & get()
accesses the underlying object
Definition os.hpp:160
const T & get() const
accesses the underlying object as a constant reference
Definition os.hpp:167
T data
The stored object, aligned to twice the cacheline size.
Definition os.hpp:153
taskflow namespace
Definition small_vector.hpp:20
std::string get_env(const std::string &str)
retrieves the value of an environment variable
Definition os.hpp:183
bool has_env(const std::string &str)
checks whether an environment variable is defined
Definition os.hpp:213