diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-04-18 21:44:09 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-04-18 21:44:09 +0000 |
commit | ab818e033a7c29898da7778a75bd69a2bcf530c5 (patch) | |
tree | 9f15cdc381f1c3cdbdd327120c43060d55b9ee16 /cpp/test/IceUtil/ctrlCHandler/Client.cpp | |
parent | bug fix for service shutdown (diff) | |
download | ice-ab818e033a7c29898da7778a75bd69a2bcf530c5.tar.bz2 ice-ab818e033a7c29898da7778a75bd69a2bcf530c5.tar.xz ice-ab818e033a7c29898da7778a75bd69a2bcf530c5.zip |
StaticMutex, CtrlCHandler and Applicaton signal handling update
Diffstat (limited to 'cpp/test/IceUtil/ctrlCHandler/Client.cpp')
-rw-r--r-- | cpp/test/IceUtil/ctrlCHandler/Client.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cpp/test/IceUtil/ctrlCHandler/Client.cpp b/cpp/test/IceUtil/ctrlCHandler/Client.cpp new file mode 100644 index 00000000000..ef2444a3ead --- /dev/null +++ b/cpp/test/IceUtil/ctrlCHandler/Client.cpp @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#include <TestCommon.h> +#include <IceUtil/CtrlCHandler.h> +#include <IceUtil/Thread.h> +#include <IceUtil/Time.h> + +using namespace IceUtil; +using namespace std; + +void callback(int signal) +{ + cout << "Handling signal " << signal << endl; +} + +int main() +{ + { + cout << "First ignore CTRL+C and the like for 20 seconds (try it!)" << endl; + CtrlCHandler handler; + ThreadControl::sleep(Time::seconds(20)); + + cout << "Then handling them for another 20 seconds (try it)" << endl; + handler.setCallback(callback); + ThreadControl::sleep(Time::seconds(20)); + } + cout << "And another 20 seconds after ~CtrlCHandler" << endl; + ThreadControl::sleep(Time::seconds(20)); + + cout << "ok" << endl; + return EXIT_SUCCESS; +} |