Commit a7426cc4 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

cut macro FOLLY_HAVE_EVENTFD

Summary: No place which defines this nominally owns the name.

Reviewed By: Gownta

Differential Revision: D32632858

fbshipit-source-id: ab5ee161b7c80f08a177c752c4bfe693cf9c9de3
parent 9549eeb5
......@@ -28,7 +28,7 @@ EventBaseAtomicNotificationQueue<Task, Consumer>::
: pid_(get_cached_pid()),
notificationQueue_(),
consumer_(std::move(consumer)) {
#ifdef FOLLY_HAVE_EVENTFD
#if __has_include(<sys/eventfd.h>)
eventfd_ = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
if (eventfd_ == -1) {
if (errno == ENOSYS || errno == EINVAL) {
......
......@@ -24,7 +24,6 @@
#include <folly/portability/Unistd.h>
#if __has_include(<sys/eventfd.h>)
#define FOLLY_HAVE_EVENTFD
#include <sys/eventfd.h>
#endif
......
......@@ -42,7 +42,6 @@
#include <folly/system/Pid.h>
#if __has_include(<sys/eventfd.h>)
#define FOLLY_HAVE_EVENTFD
#include <sys/eventfd.h>
#endif
......@@ -236,10 +235,8 @@ class NotificationQueue {
};
enum class FdType {
PIPE,
#ifdef FOLLY_HAVE_EVENTFD
PIPE = 1,
EVENTFD,
#endif
};
/**
......@@ -258,18 +255,18 @@ class NotificationQueue {
* mostly for testing purposes.
*/
explicit NotificationQueue(
uint32_t maxSize = 0,
#ifdef FOLLY_HAVE_EVENTFD
FdType fdType = FdType::EVENTFD)
#else
FdType fdType = FdType::PIPE)
#endif
uint32_t maxSize = 0, FdType fdType = FdType::EVENTFD)
: eventfd_(-1),
pipeFds_{-1, -1},
advisoryMaxQueueSize_(maxSize),
pid_(folly::get_cached_pid()) {
#if !__has_include(<sys/eventfd.h>)
if (fdType == FdType::EVENTFD) {
fdType = FdType::PIPE;
}
#endif
#ifdef FOLLY_HAVE_EVENTFD
#if __has_include(<sys/eventfd.h>)
if (fdType == FdType::EVENTFD) {
eventfd_ = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
if (eventfd_ == -1) {
......@@ -289,6 +286,7 @@ class NotificationQueue {
}
}
#endif
if (fdType == FdType::PIPE) {
if (pipe(pipeFds_)) {
folly::throwSystemError(
......
......@@ -499,7 +499,6 @@ TEST(NotificationQueueTest, ConsumeUntilDrainedStress) {
}
}
#ifdef FOLLY_HAVE_EVENTFD
TEST(NotificationQueueTest, SendOneEventFD) {
QueueTest qt(0, IntQueue::FdType::EVENTFD);
qt.sendOne();
......@@ -529,7 +528,6 @@ TEST(NotificationQueueTest, DestroyCallbackEventFD) {
QueueTest qt(0, IntQueue::FdType::EVENTFD);
qt.destroyCallback();
}
#endif
TEST(NotificationQueueTest, SendOnePipe) {
QueueTest qt(0, IntQueue::FdType::PIPE);
......
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