summaryrefslogtreecommitdiff
path: root/ACE/ace/Logging_Strategy.cpp
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-03-17 14:42:24 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-03-17 14:42:24 +0000
commit1a549566d0b3e1c920b9f0414ca0c1d854511747 (patch)
tree149871b02d6ad0b845de415c3039bb9daede583c /ACE/ace/Logging_Strategy.cpp
parentb5db93e26de4db7ed9dd083b058c9dfacde3a1e6 (diff)
downloadATCD-1a549566d0b3e1c920b9f0414ca0c1d854511747.tar.gz
Wed Mar 17 14:24:20 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com>
* ace/Logging_Strategy.cpp: * ace/Logging_Strategy.h: Extended ACE_Logging_Strategy to allow safely change reactor used by this logging strategy.
Diffstat (limited to 'ACE/ace/Logging_Strategy.cpp')
-rw-r--r--ACE/ace/Logging_Strategy.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/ACE/ace/Logging_Strategy.cpp b/ACE/ace/Logging_Strategy.cpp
index a8cae7afb59..d7cb0001293 100644
--- a/ACE/ace/Logging_Strategy.cpp
+++ b/ACE/ace/Logging_Strategy.cpp
@@ -386,11 +386,6 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
if (this->reactor () == 0)
// Use singleton.
this->reactor (ACE_Reactor::instance ());
-
- this->reactor ()->schedule_timer
- (this, 0,
- ACE_Time_Value (this->interval_),
- ACE_Time_Value (this->interval_));
}
}
// Now set the flags for Log_Msg
@@ -551,6 +546,43 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
return 0;
}
+int
+ACE_Logging_Strategy::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ // This will reset reactor member and cancel timer events.
+ this->reactor (0);
+ return 0;
+}
+
+void
+ACE_Logging_Strategy::reactor (ACE_Reactor *r)
+{
+ if (this->reactor () != r)
+ {
+ if (this->reactor () && this->interval_ > 0 && this->max_size_ > 0)
+ {
+ this->reactor ()->cancel_timer (this);
+ }
+
+ ACE_Service_Object::reactor (r);
+
+ if (this->reactor ())
+ {
+ this->reactor ()->schedule_timer
+ (this, 0,
+ ACE_Time_Value (this->interval_),
+ ACE_Time_Value (this->interval_));
+ }
+ }
+}
+
+ACE_Reactor *
+ACE_Logging_Strategy::reactor (void) const
+{
+ return ACE_Service_Object::reactor ();
+}
+
void
ACE_Logging_Strategy::log_msg (ACE_Log_Msg *log_msg)
{