diff options
author | Mark Spruiell <mes@zeroc.com> | 2007-08-03 14:00:39 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2007-08-03 14:01:36 -0700 |
commit | 47981b2a75aba80c0023368c90bea81ba5fbe44b (patch) | |
tree | 963da74cb85021a093570417e5de068222975a0b /cpp/demo/Ice/session/Client.cpp | |
parent | Fixed bug #2326 (diff) | |
download | ice-47981b2a75aba80c0023368c90bea81ba5fbe44b.tar.bz2 ice-47981b2a75aba80c0023368c90bea81ba5fbe44b.tar.xz ice-47981b2a75aba80c0023368c90bea81ba5fbe44b.zip |
bug 2365; minor fixes
Diffstat (limited to 'cpp/demo/Ice/session/Client.cpp')
-rwxr-xr-x | cpp/demo/Ice/session/Client.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/cpp/demo/Ice/session/Client.cpp b/cpp/demo/Ice/session/Client.cpp index aeb58d692ac..c8cf00f4d87 100755 --- a/cpp/demo/Ice/session/Client.cpp +++ b/cpp/demo/Ice/session/Client.cpp @@ -11,6 +11,12 @@ #include <Ice/Ice.h> #include <Session.h> +#ifdef _WIN32 +const DWORD SIGHUP = CTRL_LOGOFF_EVENT; +#else +# include <csignal> +#endif + using namespace std; using namespace Demo; @@ -192,12 +198,6 @@ SessionClient::run(int argc, char* argv[]) } } - // - // The refresher thread must be terminated before destroy is - // called, otherwise it might get ObjectNotExistException. refresh - // is set to 0 so that if session->destroy() raises an exception - // the thread will not be re-terminated and re-joined. - // cleanup(destroy); if(shutdown) { @@ -220,9 +220,19 @@ SessionClient::run(int argc, char* argv[]) } void -SessionClient::interruptCallback(int) +SessionClient::interruptCallback(int sig) { // + // Workaround for older Linux platforms where SIGHUP is received + // when the process has a controlling terminal (such as under + // expect). + // + if(sig == SIGHUP) + { + return; + } + + // // Terminate the refresh thread, destroy the session and then // destroy the communicator, followed by an exit. We have to call // exit because main may be blocked in a cin >> s call which @@ -249,6 +259,13 @@ void SessionClient::cleanup(bool destroy) { IceUtil::Mutex::Lock sync(_mutex); + + // + // The refresher thread must be terminated before destroy is + // called, otherwise it might get ObjectNotExistException. refresh + // is set to 0 so that if session->destroy() raises an exception + // the thread will not be re-terminated and re-joined. + // if(_refresh) { _refresh->terminate(); @@ -259,8 +276,8 @@ SessionClient::cleanup(bool destroy) if(destroy && _session) { _session->destroy(); - _session = 0; } + _session = 0; } void |