THRIFT-1184 event_base memory freeing by class TNonblockingServer
adds option to use existing event base
Patch: Pavlin Radoslavov
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1153307 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TNonblockingServer.h b/lib/cpp/src/server/TNonblockingServer.h
index 7b1cf4d..31741e4 100644
--- a/lib/cpp/src/server/TNonblockingServer.h
+++ b/lib/cpp/src/server/TNonblockingServer.h
@@ -132,6 +132,7 @@
/// The event base for libevent
event_base* eventBase_;
+ bool ownEventBase_;
/// Event struct, used with eventBase_ for connection events
struct event serverEvent_;
@@ -234,6 +235,7 @@
port_(port),
threadPoolProcessing_(false),
eventBase_(NULL),
+ ownEventBase_(false),
numTConnections_(0),
numActiveProcessors_(0),
connectionStackLimit_(CONNECTION_STACK_LIMIT),
@@ -259,6 +261,7 @@
port_(port),
threadManager_(threadManager),
eventBase_(NULL),
+ ownEventBase_(false),
numTConnections_(0),
numActiveProcessors_(0),
connectionStackLimit_(CONNECTION_STACK_LIMIT),
@@ -293,6 +296,7 @@
port_(port),
threadManager_(threadManager),
eventBase_(NULL),
+ ownEventBase_(false),
numTConnections_(0),
numActiveProcessors_(0),
connectionStackLimit_(CONNECTION_STACK_LIMIT),
@@ -704,8 +708,10 @@
* Register the core libevent events onto the proper base.
*
* @param base pointer to the event base to be initialized.
+ * @param ownEventBase if true, this server is responsible for
+ * freeing the event base memory.
*/
- void registerEvents(event_base* base);
+ void registerEvents(event_base* base, bool ownEventBase = true);
/**
* Main workhorse function, starts up the server listening on a port and