From 84d9f5c369fceccfa16401ed50783ed2ad209559 Mon Sep 17 00:00:00 2001 From: Matthew Newhook Date: Fri, 22 Dec 2006 18:52:53 +0000 Subject: http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1391. --- cpp/demo/Ice/throughput/Client.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'cpp/demo/Ice/throughput/Client.cpp') diff --git a/cpp/demo/Ice/throughput/Client.cpp b/cpp/demo/Ice/throughput/Client.cpp index 03bfd13aeec..a2c00c008a3 100644 --- a/cpp/demo/Ice/throughput/Client.cpp +++ b/cpp/demo/Ice/throughput/Client.cpp @@ -20,6 +20,7 @@ class ThroughputClient : public Ice::Application public: virtual int run(int, char*[]); + virtual void interruptCallback(int); private: @@ -36,6 +37,12 @@ main(int argc, char* argv[]) int ThroughputClient::run(int argc, char* argv[]) { + // + // Since this is an interactive demo we want the custom interrupt + // callback to be called when the process is interrupted. + // + userCallbackOnInterrupt(); + Ice::ObjectPrx base = communicator()->propertyToProxy("Throughput.Throughput"); ThroughputPrx throughput = ThroughputPrx::checkedCast(base); if(!throughput) @@ -377,6 +384,24 @@ ThroughputClient::run(int argc, char* argv[]) return EXIT_SUCCESS; } +void +ThroughputClient::interruptCallback(int) +{ + try + { + communicator()->destroy(); + } + catch(const IceUtil::Exception& ex) + { + cerr << appName() << ": " << ex << endl; + } + catch(...) + { + cerr << appName() << ": unknown exception" << endl; + } + exit(EXIT_SUCCESS); +} + void ThroughputClient::menu() { -- cgit v1.2.3