Commit ff841baa authored by Giuseppe Ottaviano's avatar Giuseppe Ottaviano Committed by Facebook GitHub Bot

Do not leak GFlags.h in widely included headers

Summary: It defines several generically named macros, better avoid including it everywhere.

Reviewed By: aary

Differential Revision: D29870524

fbshipit-source-id: b8703a737a6dc53e00c13daebc445855bfbadd1f
parent 5e2ab64f
......@@ -19,11 +19,6 @@
#include <atomic>
#include <chrono>
#include <folly/portability/GFlags.h>
DECLARE_int32(codel_interval);
DECLARE_int32(codel_target_delay);
namespace folly {
/// CoDel (controlled delay) is an active queue management algorithm from
......
......@@ -19,8 +19,11 @@
#include <chrono>
#include <thread>
#include <folly/portability/GFlags.h>
#include <folly/portability/GTest.h>
DECLARE_int32(codel_target_delay);
using std::chrono::milliseconds;
using std::this_thread::sleep_for;
......
......@@ -19,8 +19,6 @@
#include <atomic>
#include <memory>
#include <folly/portability/GFlags.h>
///
/// Forward declatations and implicit documentation of all hazptr
/// top-level classes, functions, macros, default values, and globals.
......@@ -33,8 +31,6 @@
#define FOLLY_HAZPTR_THR_LOCAL true
#endif
DECLARE_bool(folly_hazptr_use_executor);
namespace folly {
///
......@@ -189,6 +185,9 @@ void hazard_pointer_clean_up(
/** Global default domain defined in Hazptr.cpp */
extern hazptr_domain<std::atomic> default_domain;
/** Defined in Hazptr.cpp */
bool hazptr_use_executor();
///
/// Classes related to hazard pointer holders.
/// Defined in HazptrHolder.h
......
......@@ -29,4 +29,8 @@ namespace folly {
FOLLY_STATIC_CTOR_PRIORITY_MAX hazptr_domain<std::atomic> default_domain;
bool hazptr_use_executor() {
return FLAGS_folly_hazptr_use_executor;
}
} // namespace folly
......@@ -313,8 +313,7 @@ class hazptr_domain {
return;
}
if (std::is_same<Atom<int>, std::atomic<int>>{} &&
this == &default_hazptr_domain<Atom>() &&
FLAGS_folly_hazptr_use_executor) {
this == &default_hazptr_domain<Atom>() && hazptr_use_executor()) {
invoke_reclamation_in_executor(rcount);
} else {
do_reclamation(rcount);
......
......@@ -38,7 +38,7 @@ folly::Executor* get_hazptr_tpe() {
namespace folly {
void enable_hazptr_thread_pool_executor() {
if (FLAGS_folly_hazptr_use_executor) {
if (hazptr_use_executor()) {
default_hazptr_domain().set_executor(&get_hazptr_tpe);
}
}
......
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