summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/Flusher.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceStorm/Flusher.h')
-rw-r--r--cpp/src/IceStorm/Flusher.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/cpp/src/IceStorm/Flusher.h b/cpp/src/IceStorm/Flusher.h
index a5ce6dd7c2f..33d305884f5 100644
--- a/cpp/src/IceStorm/Flusher.h
+++ b/cpp/src/IceStorm/Flusher.h
@@ -12,7 +12,9 @@
#include <IceUtil/Handle.h>
#include <IceUtil/Shared.h>
+#include <IceUtil/Thread.h>
#include <Ice/CommunicatorF.h>
+#include <list>
namespace IceStorm
{
@@ -20,14 +22,40 @@ namespace IceStorm
//
// Forward declarations.
//
-class FlusherThread;
-typedef IceUtil::Handle<FlusherThread> FlusherThreadPtr;
-
class TraceLevels;
typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
class Flushable;
typedef IceUtil::Handle<Flushable> FlushablePtr;
+typedef std::list<FlushablePtr> FlushableList;
+
+//
+// Flusher Thread
+//
+class FlusherThread : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
+{
+public:
+
+ FlusherThread(const Ice::CommunicatorPtr&, const TraceLevelsPtr&);
+ ~FlusherThread();
+
+ virtual void run();
+ void destroy();
+ void add(const FlushablePtr&);
+ void remove(const FlushablePtr&);
+private:
+
+ void flushAll();
+ long calcTimeout();
+
+ Ice::CommunicatorPtr _communicator;
+ TraceLevelsPtr _traceLevels;
+ FlushableList _subscribers;
+ bool _destroy;
+ long _flushTime;
+};
+
+typedef IceUtil::Handle<FlusherThread> FlusherThreadPtr;
//
// Responsible for flushing Flushable objects at regular intervals.