Commit cacdd1d5 authored by Eric Niebler's avatar Eric Niebler Committed by Facebook Github Bot

give EventBase a non-explicit default constructor

Summary: Default constructors are strange and often unexpected. Refactor.

Reviewed By: yfeldblum

Differential Revision: D6667480

fbshipit-source-id: 24c456c46c846c61e28f1a88806d7c36d9192493
parent 42452e30
/* /*
* Copyright 2017 Facebook, Inc. * Copyright 2017-present Facebook, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <atomic> #include <atomic>
...@@ -199,6 +198,13 @@ class EventBase : private boost::noncopyable, ...@@ -199,6 +198,13 @@ class EventBase : private boost::noncopyable,
Func function_; Func function_;
}; };
/**
* Create a new EventBase object.
*
* Same as EventBase(true), which constructs an EventBase that measures time.
*/
EventBase() : EventBase(true) {}
/** /**
* Create a new EventBase object. * Create a new EventBase object.
* *
...@@ -208,7 +214,7 @@ class EventBase : private boost::noncopyable, ...@@ -208,7 +214,7 @@ class EventBase : private boost::noncopyable,
* that relies on time-measurement, including: * that relies on time-measurement, including:
* observer, max latency and avg loop time. * observer, max latency and avg loop time.
*/ */
explicit EventBase(bool enableTimeMeasurement = true); explicit EventBase(bool enableTimeMeasurement);
/** /**
* Create a new EventBase object that will use the specified libevent * Create a new EventBase object that will use the specified libevent
......
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