1
0
Fork 0

fix Windows ifdefs (#3824)

This commit is contained in:
Jan 2017-12-06 18:43:12 +01:00 committed by GitHub
parent c14076744b
commit 9f8c5488c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View File

@ -34,7 +34,7 @@
#include "RocksDBThrottle.h" #include "RocksDBThrottle.h"
#ifndef WIN32 #ifndef _WIN32
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
@ -155,11 +155,11 @@ void RocksDBThrottle::StopThread() {
/// @brief CompactionEventListener::OnCompaction() will get called for every key in a /// @brief CompactionEventListener::OnCompaction() will get called for every key in a
/// compaction. We only need the "level" parameter to see if thread priority should change. /// compaction. We only need the "level" parameter to see if thread priority should change.
/// ///
#ifndef WIN32 #ifndef _WIN32
CompactionEventListener * RocksDBThrottle::GetCompactionEventListener() {return &gCompactionListener;}; CompactionEventListener * RocksDBThrottle::GetCompactionEventListener() {return &gCompactionListener;};
#else #else
CompactionEventListener * RocksDBThrottle::GetCompactionEventListener() {return nullptr;}; CompactionEventListener * RocksDBThrottle::GetCompactionEventListener() {return nullptr;};
#endif // WIN32 #endif // _WIN32
/// ///
/// @brief rocksdb does not track flush time in its statistics. Save start time in /// @brief rocksdb does not track flush time in its statistics. Save start time in
@ -486,7 +486,7 @@ int64_t RocksDBThrottle::ComputeBacklog() {
/// @brief Adjust the active thread's priority to match the work /// @brief Adjust the active thread's priority to match the work
/// it is performing. The routine is called HEAVILY. /// it is performing. The routine is called HEAVILY.
void RocksDBThrottle::AdjustThreadPriority(int Adjustment) { void RocksDBThrottle::AdjustThreadPriority(int Adjustment) {
#ifndef WIN32 #ifndef _WIN32
// initialize thread infor if this the first time the thread has ever called // initialize thread infor if this the first time the thread has ever called
if (!gThreadPriority._baseSet) { if (!gThreadPriority._baseSet) {
pid_t tid; pid_t tid;

View File

@ -51,7 +51,7 @@
// ugliness starts here ... this will go away if rocksdb adds pluggable write_controller. // ugliness starts here ... this will go away if rocksdb adds pluggable write_controller.
// need either ROCKSDB_PLATFORM_POSIX or OS_WIN set before the <db/...> includes // need either ROCKSDB_PLATFORM_POSIX or OS_WIN set before the <db/...> includes
using namespace rocksdb; using namespace rocksdb;
#ifndef WIN32 #ifndef _WIN32
#define ROCKSDB_PLATFORM_POSIX 1 #define ROCKSDB_PLATFORM_POSIX 1
#else #else
#define OS_WIN 1 #define OS_WIN 1

View File

@ -160,7 +160,7 @@ void SchedulerFeature::stop() {
exitSignals->cancel(); exitSignals->cancel();
} }
#ifndef WIN32 #ifndef _WIN32
if (_hangupSignals != nullptr) { if (_hangupSignals != nullptr) {
_hangupSignals->cancel(); _hangupSignals->cancel();
_hangupSignals.reset(); _hangupSignals.reset();
@ -271,7 +271,7 @@ void SchedulerFeature::buildScheduler() {
} }
void SchedulerFeature::buildControlCHandler() { void SchedulerFeature::buildControlCHandler() {
#ifdef WIN32 #ifdef _WIN32
{ {
int result = SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, true); int result = SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, true);
@ -281,7 +281,6 @@ void SchedulerFeature::buildControlCHandler() {
} }
#else #else
#ifndef WIN32
// Signal masking on POSIX platforms // Signal masking on POSIX platforms
// //
// POSIX allows signals to be blocked using functions such as sigprocmask() // POSIX allows signals to be blocked using functions such as sigprocmask()
@ -291,7 +290,6 @@ void SchedulerFeature::buildControlCHandler() {
sigset_t all; sigset_t all;
sigemptyset(&all); sigemptyset(&all);
pthread_sigmask(SIG_SETMASK, &all, 0); pthread_sigmask(SIG_SETMASK, &all, 0);
#endif
auto ioService = _scheduler->managerService(); auto ioService = _scheduler->managerService();
_exitSignals = std::make_shared<boost::asio::signal_set>(*ioService, SIGINT, _exitSignals = std::make_shared<boost::asio::signal_set>(*ioService, SIGINT,
@ -326,7 +324,7 @@ void SchedulerFeature::buildControlCHandler() {
} }
void SchedulerFeature::buildHangupHandler() { void SchedulerFeature::buildHangupHandler() {
#ifndef WIN32 #ifndef _WIN32
auto ioService = _scheduler->managerService(); auto ioService = _scheduler->managerService();
_hangupSignals = _hangupSignals =

View File

@ -86,7 +86,7 @@ RocksDBOptionFeature::RocksDBOptionFeature(
// setting the number of background jobs to // setting the number of background jobs to
_maxBackgroundJobs = static_cast<int32_t>(std::max((size_t)2, _maxBackgroundJobs = static_cast<int32_t>(std::max((size_t)2,
std::min(TRI_numberProcessors(), (size_t)8))); std::min(TRI_numberProcessors(), (size_t)8)));
#ifdef WIN32 #ifdef _WIN32
// Windows code does not (yet) support lowering thread priority of // Windows code does not (yet) support lowering thread priority of
// compactions. Therefore it is possible for rocksdb to use all // compactions. Therefore it is possible for rocksdb to use all
// CPU time on compactions. Essential network communications can be lost. // CPU time on compactions. Essential network communications can be lost.

View File

@ -83,7 +83,7 @@ static int ExtractCurrentFile(unzFile uf, void* buffer, size_t const bufferSize,
// adjust file name // adjust file name
p = filenameInZip; p = filenameInZip;
while (*p != '\0') { while (*p != '\0') {
#ifdef WIN32 #ifdef _WIN32
if (*p == '/') { if (*p == '/') {
*p = '\\'; *p = '\\';
} }