summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2005-02-06 13:25:24 +0000
committerMarc Laukien <marc@zeroc.com>2005-02-06 13:25:24 +0000
commit7cdd61d3bdfb44c04bc9a7080f779681736a017b (patch)
tree2ba062f610b54b239d5015bf06817987b3c7b4b3 /cpp
parentmake depend (diff)
downloadice-7cdd61d3bdfb44c04bc9a7080f779681736a017b.tar.bz2
ice-7cdd61d3bdfb44c04bc9a7080f779681736a017b.tar.xz
ice-7cdd61d3bdfb44c04bc9a7080f779681736a017b.zip
improved demo
Diffstat (limited to 'cpp')
-rw-r--r--cpp/demo/Ice/bidir/CallbackI.cpp37
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++);
+ }
}
}
}
}
-