summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-11-08 14:30:19 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-11-08 14:30:19 +0000
commit82e38314775c2e25119f42fc74289091c78161b7 (patch)
tree8a06cf36e796c347211130decef6c906919f1f6d /cpp
parentRenamed "wait for activation" to "server lifetime" (diff)
downloadice-82e38314775c2e25119f42fc74289091c78161b7.tar.bz2
ice-82e38314775c2e25119f42fc74289091c78161b7.tar.xz
ice-82e38314775c2e25119f42fc74289091c78161b7.zip
Fix C++Builder build
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/IceGrid/AdminSessionI.cpp54
-rw-r--r--cpp/src/IceStorm/SubscriberPool.cpp142
-rw-r--r--cpp/src/IceStorm/SubscriberPool.h30
-rw-r--r--cpp/src/IceStorm/Subscribers.cpp11
-rw-r--r--cpp/test/include/TestCommon.h4
5 files changed, 146 insertions, 95 deletions
diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp
index bdf87d55c6a..de31ff90996 100644
--- a/cpp/src/IceGrid/AdminSessionI.cpp
+++ b/cpp/src/IceGrid/AdminSessionI.cpp
@@ -58,16 +58,50 @@ AdminSessionI::setObservers(const RegistryObserverPrx& registryObserver,
throw ex;
}
- setupObserverSubscription(RegistryObserverTopicName,
- registryObserver ? registryObserver->ice_timeout(_timeout * 1000) : Ice::ObjectPrx());
- setupObserverSubscription(NodeObserverTopicName,
- nodeObserver ? nodeObserver->ice_timeout(_timeout * 1000) : Ice::ObjectPrx());
- setupObserverSubscription(ApplicationObserverTopicName,
- appObserver ? appObserver->ice_timeout(_timeout * 1000) : Ice::ObjectPrx());
- setupObserverSubscription(AdapterObserverTopicName,
- adapterObserver ? adapterObserver->ice_timeout(_timeout * 1000) : Ice::ObjectPrx());
- setupObserverSubscription(ObjectObserverTopicName,
- objectObserver ? objectObserver->ice_timeout(_timeout * 1000) : Ice::ObjectPrx());
+ if(registryObserver)
+ {
+ setupObserverSubscription(RegistryObserverTopicName, registryObserver->ice_timeout(_timeout * 1000));
+ }
+ else
+ {
+ setupObserverSubscription(RegistryObserverTopicName, Ice::ObjectPrx());
+ }
+
+ if(nodeObserver)
+ {
+ setupObserverSubscription(NodeObserverTopicName, nodeObserver->ice_timeout(_timeout * 1000));
+ }
+ else
+ {
+ setupObserverSubscription(NodeObserverTopicName, Ice::ObjectPrx());
+ }
+
+ if(appObserver)
+ {
+ setupObserverSubscription(ApplicationObserverTopicName, appObserver->ice_timeout(_timeout * 1000));
+ }
+ else
+ {
+ setupObserverSubscription(ApplicationObserverTopicName, Ice::ObjectPrx());
+ }
+
+ if(adapterObserver)
+ {
+ setupObserverSubscription(AdapterObserverTopicName, adapterObserver->ice_timeout(_timeout * 1000));
+ }
+ else
+ {
+ setupObserverSubscription(AdapterObserverTopicName, Ice::ObjectPrx());
+ }
+
+ if(objectObserver)
+ {
+ setupObserverSubscription(ObjectObserverTopicName, objectObserver->ice_timeout(_timeout * 1000));
+ }
+ else
+ {
+ setupObserverSubscription(ObjectObserverTopicName, Ice::ObjectPrx());
+ }
}
void
diff --git a/cpp/src/IceStorm/SubscriberPool.cpp b/cpp/src/IceStorm/SubscriberPool.cpp
index db32060fa8c..6f42665af37 100644
--- a/cpp/src/IceStorm/SubscriberPool.cpp
+++ b/cpp/src/IceStorm/SubscriberPool.cpp
@@ -64,93 +64,81 @@ private:
const SubscriberPoolPtr _manager;
};
-class SubscriberPoolMonitor : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
-{
-public:
-
- SubscriberPoolMonitor(const SubscriberPoolPtr& manager, const IceUtil::Time& timeout) :
- _manager(manager),
- _timeout(timeout),
- _needCheck(false),
- _destroy(false)
- {
- start();
- }
-
- ~SubscriberPoolMonitor()
- {
- }
+}
- virtual void
- run()
- {
- for(;;)
- {
- {
- Lock sync(*this);
- if(_destroy)
- {
- return;
- }
-
- if(_needCheck)
- {
- timedWait(_timeout);
- //
- // Monitoring was stopped.
- //
- if(!_needCheck)
- {
- continue;
- }
- }
- else
- {
- wait();
- continue;
- }
- }
- //
- // Call outside of the lock to prevent any deadlocks.
- //
- _manager->check();
- }
- }
+SubscriberPoolMonitor::SubscriberPoolMonitor(const SubscriberPoolPtr& manager, const IceUtil::Time& timeout) :
+ _manager(manager),
+ _timeout(timeout),
+ _needCheck(false),
+ _destroy(false)
+{
+ start();
+}
- void
- startMonitor()
- {
- Lock sync(*this);
- if(!_needCheck)
- {
- _needCheck = true;
- notify();
- }
- }
+SubscriberPoolMonitor::~SubscriberPoolMonitor()
+{
+}
- void
- stopMonitor()
+void
+SubscriberPoolMonitor::run()
+{
+ for(;;)
{
- Lock sync(*this);
- _needCheck = false;
+ {
+ Lock sync(*this);
+ if(_destroy)
+ {
+ return;
+ }
+
+ if(_needCheck)
+ {
+ timedWait(_timeout);
+ //
+ // Monitoring was stopped.
+ //
+ if(!_needCheck)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ wait();
+ continue;
+ }
+ }
+ //
+ // Call outside of the lock to prevent any deadlocks.
+ //
+ _manager->check();
}
+}
- void
- destroy()
+void
+SubscriberPoolMonitor::startMonitor()
+{
+ Lock sync(*this);
+ if(!_needCheck)
{
- Lock sync(*this);
- _destroy = true;
- notify();
+ _needCheck = true;
+ notify();
}
+}
-private:
-
- const SubscriberPoolPtr _manager;
- const IceUtil::Time _timeout;
- bool _needCheck;
- bool _destroy;
-};
+void
+SubscriberPoolMonitor::stopMonitor()
+{
+ Lock sync(*this);
+ _needCheck = false;
+}
+void
+SubscriberPoolMonitor::destroy()
+{
+ Lock sync(*this);
+ _destroy = true;
+ notify();
}
SubscriberPool::SubscriberPool(const InstancePtr& instance) :
diff --git a/cpp/src/IceStorm/SubscriberPool.h b/cpp/src/IceStorm/SubscriberPool.h
index eca417210b1..ce6416452db 100644
--- a/cpp/src/IceStorm/SubscriberPool.h
+++ b/cpp/src/IceStorm/SubscriberPool.h
@@ -10,6 +10,8 @@
#ifndef SUBSCRIBER_POOL_H
#define SUBSCRIBER_POOL_H
+#include <IceStorm/Subscribers.h>
+
#include <IceUtil/Mutex.h>
#include <IceUtil/Monitor.h>
#include <IceUtil/Time.h>
@@ -25,10 +27,30 @@ namespace IceStorm
class Instance;
typedef IceUtil::Handle<Instance> InstancePtr;
-class Subscriber;
-typedef IceUtil::Handle<Subscriber> SubscriberPtr;
+class SubscriberPool;
+typedef IceUtil::Handle<SubscriberPool> SubscriberPoolPtr;
+
+class SubscriberPoolMonitor : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
+{
+public:
+
+ SubscriberPoolMonitor(const SubscriberPoolPtr&, const IceUtil::Time&);
+ ~SubscriberPoolMonitor();
+
+ virtual void run();
+
+ void startMonitor();
+ void stopMonitor();
+ void destroy();
+
+private:
+
+ const SubscriberPoolPtr _manager;
+ const IceUtil::Time _timeout;
+ bool _needCheck;
+ bool _destroy;
+};
-class SubscriberPoolMonitor;
typedef IceUtil::Handle<SubscriberPoolMonitor> SubscriberPoolMonitorPtr;
class SubscriberPool : public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
@@ -66,8 +88,6 @@ private:
IceUtil::Time _lastNext;
};
-typedef IceUtil::Handle<SubscriberPool> SubscriberPoolPtr;
-
} // End namespace IceStorm
#endif
diff --git a/cpp/src/IceStorm/Subscribers.cpp b/cpp/src/IceStorm/Subscribers.cpp
index beefea946a6..2aca83c3ca9 100644
--- a/cpp/src/IceStorm/Subscribers.cpp
+++ b/cpp/src/IceStorm/Subscribers.cpp
@@ -19,6 +19,10 @@
#include <Ice/LocalException.h>
#include <Ice/Connection.h>
+#ifdef __BCPLUSPLUS__
+#include <iterator>
+#endif
+
using namespace std;
using namespace IceStorm;
@@ -100,7 +104,7 @@ public:
private:
const bool _batch;
const Ice::ObjectPrx _obj;
- const Ice::ObjectPrx _objBatch;
+ /*const*/ Ice::ObjectPrx _objBatch;
};
class SubscriberTwoway : public Subscriber
@@ -167,9 +171,10 @@ SubscriberOneway::SubscriberOneway(
bool batch) :
Subscriber(instance, proxy, false, obj->ice_getIdentity()),
_batch(batch),
- _obj(obj),
- _objBatch(obj->ice_isDatagram() ? obj->ice_batchDatagram() : obj->ice_batchOneway())
+ _obj(obj)
{
+ _objBatch = obj->ice_isDatagram() ? _obj->ice_batchDatagram() : _obj->ice_batchOneway();
+
if(batch)
{
_instance->batchFlusher()->add(_obj);
diff --git a/cpp/test/include/TestCommon.h b/cpp/test/include/TestCommon.h
index 904fd629a75..7edcc36020b 100644
--- a/cpp/test/include/TestCommon.h
+++ b/cpp/test/include/TestCommon.h
@@ -13,6 +13,10 @@
#include <IceUtil/Config.h>
#include <cstdlib>
+#ifdef __BCPLUSPLUS__
+#include <stdlib.h>
+#endif
+
void
inline testFailed(const char* expr, const char* file, unsigned int line)
{