Commit 2cb34df8 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Change an ifdef to a constexpr ternary

Summary: [Folly] Change an `#ifdef` to a constexpr ternary for `MemoryMapping`.

Reviewed By: meyering

Differential Revision: D18024494

fbshipit-source-id: 7ee040891ecee9bccf46af1dc43e54946e676c70
parent 60df0a6b
......@@ -24,6 +24,7 @@
#include <glog/logging.h>
#include <folly/Format.h>
#include <folly/Portability.h>
#include <folly/portability/GFlags.h>
#include <folly/portability/SysMman.h>
#include <folly/portability/SysSyscall.h>
......@@ -36,18 +37,14 @@
#include <sys/types.h>
#include <system_error>
static constexpr ssize_t kDefaultMlockChunkSize =
#ifndef _MSC_VER
static constexpr ssize_t kDefaultMlockChunkSize = !folly::kMscVer
// Linux implementations of unmap/mlock/munlock take a kernel
// semaphore and block other threads from doing other memory
// operations. Split the operations in chunks.
(1 << 20) // 1MB
#else // _MSC_VER
? (1 << 20) // 1MB
// MSVC doesn't have this problem, and calling munmap many times
// with the same address is a bad idea with the windows implementation.
(-1)
#endif // _MSC_VER
;
: (-1);
DEFINE_int64(
mlock_chunk_size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment