summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/Outgoing.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2005-12-14 14:32:04 +0000
committerDwayne Boone <dwayne@zeroc.com>2005-12-14 14:32:04 +0000
commitb7758bf782ad073cc3db1503adc72fee5443bc41 (patch)
tree3c2fe3088fb6426a0de1084bc18920de35f65849 /cppe/src/IceE/Outgoing.cpp
parentAdded test (diff)
downloadice-b7758bf782ad073cc3db1503adc72fee5443bc41.tar.bz2
ice-b7758bf782ad073cc3db1503adc72fee5443bc41.tar.xz
ice-b7758bf782ad073cc3db1503adc72fee5443bc41.zip
Made Monitor in Outgoing optional
Diffstat (limited to 'cppe/src/IceE/Outgoing.cpp')
-rw-r--r--cppe/src/IceE/Outgoing.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/cppe/src/IceE/Outgoing.cpp b/cppe/src/IceE/Outgoing.cpp
index 107dd2c4054..a127aa6a565 100644
--- a/cppe/src/IceE/Outgoing.cpp
+++ b/cppe/src/IceE/Outgoing.cpp
@@ -42,6 +42,13 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
_is(ref->getInstance().get()),
_os(ref->getInstance().get())
{
+#ifndef ICEE_PURE_BLOCKING_CLIENT
+ if(!_connection->blocking())
+ {
+ _monitor.reset(new IceUtil::Monitor<IceUtil::Mutex >());
+ }
+#endif
+
switch(_reference->getMode())
{
case Reference::ModeTwoway:
@@ -136,7 +143,7 @@ IceInternal::Outgoing::invoke()
bool timedOut = false;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*_monitor.get());
//
// It's possible that the request has already
@@ -154,7 +161,7 @@ IceInternal::Outgoing::invoke()
{
if(timeout >= 0)
{
- timedWait(IceUtil::Time::milliSeconds(timeout));
+ _monitor->timedWait(IceUtil::Time::milliSeconds(timeout));
if(_state == StateInProgress)
{
@@ -163,7 +170,7 @@ IceInternal::Outgoing::invoke()
}
else
{
- wait();
+ _monitor->wait();
}
}
}
@@ -181,11 +188,11 @@ IceInternal::Outgoing::invoke()
// propagated to this Outgoing object.
//
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*_monitor.get());
while(_state == StateInProgress)
{
- wait();
+ _monitor->wait();
}
}
}
@@ -305,10 +312,11 @@ IceInternal::Outgoing::abort(const LocalException& ex)
ex.ice_throw();
}
+#ifndef ICEE_PURE_BLOCKING_CLIENT
void
IceInternal::Outgoing::finished(BasicStream& is)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*_monitor.get());
assert(_reference->getMode() == Reference::ModeTwoway); // Can only be called for twoways.
@@ -316,8 +324,9 @@ IceInternal::Outgoing::finished(BasicStream& is)
_is.swap(is);
finishedInternal();
- notify();
+ _monitor->notify();
}
+#endif
void
IceInternal::Outgoing::finishedInternal()
@@ -479,7 +488,12 @@ IceInternal::Outgoing::finishedInternal()
void
IceInternal::Outgoing::finished(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+#ifndef ICEE_PURE_BLOCKING_CLIENT
+ if(!_connection->blocking())
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*_monitor.get());
+ }
+#endif
assert(_reference->getMode() == Reference::ModeTwoway); // Can only be called for twoways.
@@ -487,5 +501,10 @@ IceInternal::Outgoing::finished(const LocalException& ex)
_state = StateLocalException;
_exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
- notify();
+#ifndef ICEE_PURE_BLOCKING_CLIENT
+ if(!_connection->blocking())
+ {
+ _monitor->notify();
+ }
+#endif
}