diff options
author | Marc Laukien <marc@zeroc.com> | 2005-02-06 13:25:24 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2005-02-06 13:25:24 +0000 |
commit | 7cdd61d3bdfb44c04bc9a7080f779681736a017b (patch) | |
tree | 2ba062f610b54b239d5015bf06817987b3c7b4b3 /cpp | |
parent | make depend (diff) | |
download | ice-7cdd61d3bdfb44c04bc9a7080f779681736a017b.tar.bz2 ice-7cdd61d3bdfb44c04bc9a7080f779681736a017b.tar.xz ice-7cdd61d3bdfb44c04bc9a7080f779681736a017b.zip |
improved demo
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Ice/bidir/CallbackI.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/cpp/demo/Ice/bidir/CallbackI.cpp b/cpp/demo/Ice/bidir/CallbackI.cpp index b2c8da3f78f..a4ddf593794 100644 --- a/cpp/demo/Ice/bidir/CallbackI.cpp +++ b/cpp/demo/Ice/bidir/CallbackI.cpp @@ -51,32 +51,29 @@ CallbackSenderI::run() { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - while(true) + while(!_destroy) { timedWait(IceUtil::Time::seconds(2)); - if(_destroy) + if(!_destroy && !_clients.empty()) { - return; - } - - ++_num; - - set<CallbackReceiverPrx>::iterator p = _clients.begin(); - while(p != _clients.end()) - { - try + ++_num; + + set<CallbackReceiverPrx>::iterator p = _clients.begin(); + while(p != _clients.end()) { - (*p)->callback(_num); - ++p; - } - catch(const Exception& ex) - { - cerr << "removing client `" << identityToString((*p)->ice_getIdentity()) << "':\n" - << ex << endl; - _clients.erase(p++); + try + { + (*p)->callback(_num); + ++p; + } + catch(const Exception& ex) + { + cerr << "removing client `" << identityToString((*p)->ice_getIdentity()) << "':\n" + << ex << endl; + _clients.erase(p++); + } } } } } - |