Proper shutdown functionality for Thrift servers

Reviewed By: karl


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665038 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TSimpleServer.h b/lib/cpp/src/server/TSimpleServer.h
index 05befbf..0bb0365 100644
--- a/lib/cpp/src/server/TSimpleServer.h
+++ b/lib/cpp/src/server/TSimpleServer.h
@@ -26,7 +26,8 @@
                 shared_ptr<TServerTransport> serverTransport,
                 shared_ptr<TTransportFactory> transportFactory,
                 shared_ptr<TProtocolFactory> protocolFactory) :
-    TServer(processor, serverTransport, transportFactory, protocolFactory) {}
+    TServer(processor, serverTransport, transportFactory, protocolFactory),
+    stop_(false) {}
 
   TSimpleServer(shared_ptr<TProcessor> processor,
                 shared_ptr<TServerTransport> serverTransport,
@@ -36,12 +37,20 @@
                 shared_ptr<TProtocolFactory> outputProtocolFactory):
     TServer(processor, serverTransport, 
             inputTransportFactory, outputTransportFactory,
-            inputProtocolFactory, outputProtocolFactory) {}
+            inputProtocolFactory, outputProtocolFactory),
+    stop_(false) {}
     
   ~TSimpleServer() {}
 
   void serve();
 
+  void stop() {
+    stop_ = true;
+  }
+
+ protected:
+  bool stop_;
+
 };
 
 }}} // facebook::thrift::server