Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / protocols / ace / RMCast / Retransmit.h
blob26d418b3db1fcd4b036ec61c79a0b0d955e5bae7
1 // author : Boris Kolpackov <boris@kolpackov.net>
2 #ifndef ACE_RMCAST_RETRANSMIT_H
3 #define ACE_RMCAST_RETRANSMIT_H
5 #include "ace/Hash_Map_Manager.h"
6 #include "ace/Thread_Manager.h"
8 #include "Stack.h"
9 #include "Protocol.h"
10 #include "Bits.h"
11 #include "Parameters.h"
13 namespace ACE_RMCast
15 class Retransmit : public Element
17 public:
18 Retransmit (Parameters const& params);
20 virtual void
21 out_start (Out_Element* out);
23 virtual void
24 out_stop ();
26 public:
27 virtual void
28 send (Message_ptr m);
30 virtual void
31 recv (Message_ptr m);
33 private:
34 struct Descr
36 // Shouldn't be available but ACE_Hash_Map needs it.
38 Descr ()
39 : msg_ (), count_ (0)
43 Descr (Message_ptr msg)
44 : msg_ (msg), count_ (0)
48 unsigned long
49 inc ()
51 return ++count_;
54 void
55 reset ()
57 count_ = 0;
60 Message_ptr
61 message () const
63 return msg_->clone ();
66 private:
67 Message_ptr msg_;
68 unsigned long count_;
71 typedef
72 ACE_Hash_Map_Manager<u64, Descr, ACE_Null_Mutex>
73 Queue;
75 private:
76 void
77 track ();
79 static ACE_THR_FUNC_RETURN
80 track_thunk (void* obj);
82 private:
83 Parameters const& params_;
85 Queue queue_;
86 Mutex mutex_;
87 Condition cond_;
89 bool stop_;
90 ACE_Thread_Manager tracker_mgr_;
95 #endif // ACE_RMCAST_RETRANSMIT_H