--- a/src/simulator/event-impl.cc Fri Jul 27 09:50:21 2007 +0200
+++ b/src/simulator/event-impl.cc Fri Jul 27 09:53:15 2007 +0200
@@ -29,8 +29,24 @@
{}
EventImpl::EventImpl ()
- : m_cancel (false)
+ : m_cancel (false),
+ m_count (1)
{}
+void
+EventImpl::Ref (void) const
+{
+ m_count++;
+}
+void
+EventImpl::Unref (void) const
+{
+ m_count--;
+ if (m_count == 0)
+ {
+ delete this;
+ }
+}
+
void
EventImpl::Invoke (void)
{
--- a/src/simulator/event-impl.h Fri Jul 27 09:50:21 2007 +0200
+++ b/src/simulator/event-impl.h Fri Jul 27 09:53:15 2007 +0200
@@ -28,6 +28,8 @@
class EventImpl {
public:
EventImpl ();
+ void Ref (void) const;
+ void Unref (void) const;
virtual ~EventImpl () = 0;
void Invoke (void);
void Cancel (void);
@@ -37,6 +39,7 @@
private:
friend class Event;
bool m_cancel;
+ mutable uint32_t m_count;
};
}; // namespace ns3