/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <folly/detail/CacheLocality.h>
+#ifndef _MSC_VER
#define _GNU_SOURCE 1 // for RTLD_NOLOAD
#include <dlfcn.h>
+#endif
#include <fstream>
#include <folly/Conv.h>
auto raw = line.c_str();
char *end;
unsigned long val = strtoul(raw, &end, 10);
- if (end == raw || (*end != ',' && *end != '-' && *end != '\n')) {
+ if (end == raw || (*end != ',' && *end != '-' && *end != '\n' && *end != 0)) {
throw std::runtime_error(to<std::string>(
"error parsing list '", line, "'").c_str());
}
/// Resolves the dynamically loaded symbol __vdso_getcpu, returning null
/// on failure
static Getcpu::Func loadVdsoGetcpu() {
+#ifdef _MSC_VER
+ return nullptr;
+#else
void* h = dlopen("linux-vdso.so.1", RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
if (h == nullptr) {
return nullptr;
}
return func;
+#endif
}
Getcpu::Func Getcpu::vdsoFunc() {
return func;
}
+#ifdef FOLLY_TLS
/////////////// SequentialThreadId
template<>
template<>
FOLLY_TLS size_t SequentialThreadId<std::atomic>::currentId(0);
+#endif
/////////////// AccessSpreader
return °enerateGetcpu;
} else {
auto best = Getcpu::vdsoFunc();
- return best ? best : &SequentialThreadId<std::atomic>::getcpu;
+ return best ? best : &FallbackGetcpuType::getcpu;
}
}