summaryrefslogtreecommitdiff
path: root/ACE/ace/Service_Types.cpp
diff options
context:
space:
mode:
authorcbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-19 12:49:11 +0000
committercbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-19 12:49:11 +0000
commitb87073cfb149a64501d8fc3b1ad0090c62441285 (patch)
tree828b8920bbd39624a03f6074045b2540662e23ee /ACE/ace/Service_Types.cpp
parentf9ca49d971c2f193cd3c139e3c3310f3a72cf246 (diff)
downloadATCD-b87073cfb149a64501d8fc3b1ad0090c62441285.tar.gz
Mon Apr 19 12:44:56 UTC 2010 Chad Beaulac <chad@objectivesolutions.com>
* ace/Service_Types.h * ace/Service_Types.inl * ace/Service_Types.cpp Added service_type_ attr to expose the type of service being managed to the ACE_Service_Repository. This allows the ASR to manage the lifecycle of the ACE_Module and ACE_Stream in order to avoid a double delete of ACE_Module at shutdown. ACE_Stream_Type::fini was modified to not call ACE_Module_Type::fini as this will results in a double delete when ACE_Service_Repository::fini is called. ACE_Stream_Type::remove(module_name) was modified to not call ACE_Module_Type::fini as this will results in a double delete when ACE_Service_Repository::fini is called also. * ace/Service_Repository.cpp Modified ASR::fini to iterate over the service_array_ twice. ACE_Service_Type::fini is called on all ACE_Stream_Type and ACE_Service_Object_Type instances first. Then, fini is called on all ACE_Modules_Type instances. All calls to fini are done in the order the services appear in the ASR::service_array_ except for the grouping described here. The calls to ACE_Module_Type::fini must be done last because ACE_Stream_Type::fini accesses the Modules so they must not be deleted by a call to ACE_Module_Type::fini before that. * tests/Bug_3334_Regresssion_Test.cpp Added call to ACE_Service_Repository::fini_svcs() to capture all debug output before the application exits. * tests/run_tests.lst This fixes Bugzilla #3334
Diffstat (limited to 'ACE/ace/Service_Types.cpp')
-rw-r--r--ACE/ace/Service_Types.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/ACE/ace/Service_Types.cpp b/ACE/ace/Service_Types.cpp
index 4552607640e..5c2c2fae3b7 100644
--- a/ACE/ace/Service_Types.cpp
+++ b/ACE/ace/Service_Types.cpp
@@ -35,11 +35,13 @@ ACE_Service_Type_Impl::dump (void) const
ACE_Service_Type_Impl::ACE_Service_Type_Impl (void *so,
const ACE_TCHAR *s_name,
u_int f,
- ACE_Service_Object_Exterminator gobbler)
+ ACE_Service_Object_Exterminator gobbler,
+ int stype)
: name_ (0),
obj_ (so),
gobbler_ (gobbler),
- flags_ (f)
+ flags_ (f),
+ service_type_ (stype)
{
ACE_TRACE ("ACE_Service_Type_Impl::ACE_Service_Type_Impl");
this->name (s_name);
@@ -82,8 +84,9 @@ ACE_Service_Type_Impl::fini (void) const
ACE_Service_Object_Type::ACE_Service_Object_Type (void *so,
const ACE_TCHAR *s_name,
u_int f,
- ACE_Service_Object_Exterminator gobbler)
- : ACE_Service_Type_Impl (so, s_name, f, gobbler)
+ ACE_Service_Object_Exterminator gobbler,
+ int stype)
+ : ACE_Service_Type_Impl (so, s_name, f, gobbler, stype)
, initialized_ (-1)
{
ACE_TRACE ("ACE_Service_Object_Type::ACE_Service_Object_Type");
@@ -164,8 +167,9 @@ ACE_Module_Type::dump (void) const
ACE_Module_Type::ACE_Module_Type (void *m,
const ACE_TCHAR *m_name,
- u_int f)
- : ACE_Service_Type_Impl (m, m_name, f)
+ u_int f,
+ int stype)
+ : ACE_Service_Type_Impl (m, m_name, f, 0, stype)
{
ACE_TRACE ("ACE_Module_Type::ACE_Module_Type");
}
@@ -230,7 +234,6 @@ int
ACE_Module_Type::fini (void) const
{
ACE_TRACE ("ACE_Module_Type::fini");
-
void *obj = this->object ();
MT_Module *mod = (MT_Module *) obj;
MT_Task *reader = mod->reader ();
@@ -324,8 +327,9 @@ ACE_Stream_Type::resume (void) const
ACE_Stream_Type::ACE_Stream_Type (void *s,
const ACE_TCHAR *s_name,
- u_int f)
- : ACE_Service_Type_Impl (s, s_name, f),
+ u_int f,
+ int stype)
+ : ACE_Service_Type_Impl (s, s_name, f, 0, stype),
head_ (0)
{
ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
@@ -361,17 +365,13 @@ ACE_Stream_Type::fini (void) const
void *obj = this->object ();
MT_Stream *str = (MT_Stream *) obj;
- for (ACE_Module_Type *m = this->head_; m != 0; )
- {
- ACE_Module_Type *t = m->link ();
+ for (ACE_Module_Type *m = this->head_; m != 0;)
+ {
+ ACE_Module_Type *t = m->link ();
// Final arg is an indication to *not* delete the Module.
str->remove (m->name (),
- MT_Module::M_DELETE_NONE);
-
- // Finalize the Module (this may delete it, but we don't really
- // care since we don't access it again).
- m->fini ();
+ MT_Module::M_DELETE_NONE);
m = t;
}
str->close ();
@@ -408,9 +408,8 @@ ACE_Stream_Type::remove (ACE_Module_Type *mod)
MT_Module::M_DELETE_NONE) == -1)
result = -1;
- // This call may end up deleting m, which is ok since we
- // don't access it again!
- m->fini ();
+ // Do not call m->fini (); as this will result in a double delete
+ // of the ACE_Module_type when ACE_Service_Repository::fini is called
}
else
prev = m;