diff options
Diffstat (limited to 'cpp/demo/Ice/async/HelloI.cpp')
-rw-r--r-- | cpp/demo/Ice/async/HelloI.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cpp/demo/Ice/async/HelloI.cpp b/cpp/demo/Ice/async/HelloI.cpp new file mode 100644 index 00000000000..4f2779faab6 --- /dev/null +++ b/cpp/demo/Ice/async/HelloI.cpp @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <HelloI.h> +#include <Ice/Ice.h> + +using namespace std; + +HelloI::HelloI(const WorkQueuePtr& workQueue) : + _workQueue(workQueue) +{ +} + +void +HelloI::sayHello_async(const Demo::AMD_Hello_sayHelloPtr& cb, int delay, const Ice::Current&) +{ + if(delay == 0) + { + cout << "Hello World!" << endl; + cb->ice_response(); + } + else + { + _workQueue->add(cb, delay); + } +} + +void +HelloI::shutdown(const Ice::Current& curr) +{ + cout << "Shutting down..." << endl; + + _workQueue->destroy(); + _workQueue->getThreadControl().join(); + + curr.adapter->getCommunicator()->shutdown(); +} |