⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testi.cpp

📁 ICE-3.2 一个开源的中间件
💻 CPP
字号:
// **********************************************************************//// 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 <TestI.h>#include <Ice/Ice.h>#include <IceUtil/Thread.h>using namespace std;using namespace Ice;class ActivateAdapterThread : public IceUtil::Thread{public:    ActivateAdapterThread(const ObjectAdapterPtr& adapter, int timeout) :        _adapter(adapter), _timeout(timeout)    {    }    virtual void    run()    {        IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_timeout));        _adapter->activate();    }private:    ObjectAdapterPtr _adapter;    int _timeout;};voidTimeoutI::op(const Ice::Current&){}voidTimeoutI::sendData(const Test::ByteSeq&, const Ice::Current&){}voidTimeoutI::sleep(Ice::Int to, const Ice::Current&){    IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(to));}voidTimeoutI::holdAdapter(Ice::Int to, const Ice::Current& current){    current.adapter->hold();    IceUtil::ThreadPtr thread = new ActivateAdapterThread(current.adapter, to);    thread->start();}voidTimeoutI::shutdown(const Ice::Current& current){    current.adapter->getCommunicator()->shutdown();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -