summaryrefslogtreecommitdiff
path: root/tests/Priority_Reactor_Test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Priority_Reactor_Test.cpp')
-rw-r--r--tests/Priority_Reactor_Test.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/Priority_Reactor_Test.cpp b/tests/Priority_Reactor_Test.cpp
index 62b0c5ae5f4..0f1253c211d 100644
--- a/tests/Priority_Reactor_Test.cpp
+++ b/tests/Priority_Reactor_Test.cpp
@@ -271,23 +271,24 @@ run_main (int argc, ACE_TCHAR *argv[])
ACE_NOTREACHED (break);
}
- // Manage memory automagically.
- // Note: This ordering is very subtle...
- auto_ptr<ACE_Reactor> reactor;
- auto_ptr<ACE_Select_Reactor> impl;
+ // Manage Reactor memory automagically.
+ // Note: If opt_priority_reactor is false, the default ACE_Reactor is used
+ // and we don't need to set one up.
+ ACE_Reactor *orig_reactor = 0;
+ auto_ptr<ACE_Reactor> reactor;
if (opt_priority_reactor)
{
ACE_Select_Reactor *impl_ptr;
ACE_NEW_RETURN (impl_ptr, ACE_Priority_Reactor, -1);
auto_ptr<ACE_Select_Reactor> auto_impl (impl_ptr);
- impl = auto_impl;
ACE_Reactor *reactor_ptr;
- ACE_NEW_RETURN (reactor_ptr, ACE_Reactor (impl_ptr), -1);
+ ACE_NEW_RETURN (reactor_ptr, ACE_Reactor (impl_ptr, 1), -1);
+ auto_impl.release (); // ACE_Reactor dtor will take it from here
auto_ptr<ACE_Reactor> auto_reactor (reactor_ptr);
reactor = auto_reactor;
- ACE_Reactor::instance (reactor_ptr);
+ orig_reactor = ACE_Reactor::instance (reactor_ptr);
}
Read_Handler::set_countdown (opt_nchildren);
@@ -387,6 +388,9 @@ run_main (int argc, ACE_TCHAR *argv[])
// We aborted on the previous #ifdef
#endif /* ACE_HAS_THREADS */
+ if (orig_reactor != 0)
+ ACE_Reactor::instance (orig_reactor);
+
ACE_END_TEST;
return 0;
}