diff options
author | Matthew Newhook <matthew@zeroc.com> | 2006-12-22 18:52:53 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2006-12-22 18:52:53 +0000 |
commit | 84d9f5c369fceccfa16401ed50783ed2ad209559 (patch) | |
tree | 689d30c8707629f1db8155edadb47ce1bce363ad /cpp/demo/Freeze/library/Client.cpp | |
parent | Added autoflushing of batches (diff) | |
download | ice-84d9f5c369fceccfa16401ed50783ed2ad209559.tar.bz2 ice-84d9f5c369fceccfa16401ed50783ed2ad209559.tar.xz ice-84d9f5c369fceccfa16401ed50783ed2ad209559.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1391.
Diffstat (limited to 'cpp/demo/Freeze/library/Client.cpp')
-rw-r--r-- | cpp/demo/Freeze/library/Client.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cpp/demo/Freeze/library/Client.cpp b/cpp/demo/Freeze/library/Client.cpp index dab9aaa2607..f43eeedf738 100644 --- a/cpp/demo/Freeze/library/Client.cpp +++ b/cpp/demo/Freeze/library/Client.cpp @@ -15,6 +15,7 @@ using namespace std; class LibraryClient : public Ice::Application { virtual int run(int argc, char* argv[]); + virtual void interruptCallback(int); }; int @@ -27,6 +28,30 @@ main(int argc, char* argv[]) int LibraryClient::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(); + int runParser(int, char*[], const Ice::CommunicatorPtr&); return runParser(argc, argv, communicator()); } + +void +LibraryClient::interruptCallback(int) +{ + try + { + communicator()->destroy(); + } + catch(const IceUtil::Exception& ex) + { + cerr << appName() << ": " << ex << endl; + } + catch(...) + { + cerr << appName() << ": unknown exception" << endl; + } + exit(EXIT_SUCCESS); +} |