diff options
author | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-04-08 20:31:43 +0000 |
---|---|---|
committer | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-04-08 20:31:43 +0000 |
commit | 14896e4e7d7dd09aaaed3d672935e6816ec99692 (patch) | |
tree | 243d8c7e1674a522a36209f9c4f8ac2c0b77101d | |
parent | 39f5109f58c253f97abcfaf5582843ddc7af8547 (diff) | |
download | ATCD-14896e4e7d7dd09aaaed3d672935e6816ec99692.tar.gz |
ChangeLogTag: Tue Apr 8 20:25:28 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r-- | ACE/ChangeLog.iliyan-gestalt | 10 | ||||
-rw-r--r-- | ACE/ace/Service_Gestalt.cpp | 8 | ||||
-rw-r--r-- | ACE/ace/Service_Repository.cpp | 130 |
3 files changed, 87 insertions, 61 deletions
diff --git a/ACE/ChangeLog.iliyan-gestalt b/ACE/ChangeLog.iliyan-gestalt index 30ac6d9b59f..549a20c9aaa 100644 --- a/ACE/ChangeLog.iliyan-gestalt +++ b/ACE/ChangeLog.iliyan-gestalt @@ -1,3 +1,13 @@ +Tue Apr 8 20:25:28 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com> + + * ace/Service_Gestalt.cpp: + * ace/Service_Repository.cpp: + + Eliminating artifacts introduced with the synchronization with + the trunk. Fixing a problem with SR::insert for dynamic + services, whose DLL's contain static initializers for the very + same service (Strategies:UIOP_Factory). + Sat Apr 5 13:02:32 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com> * ace/Service_Repository.cpp: diff --git a/ACE/ace/Service_Gestalt.cpp b/ACE/ace/Service_Gestalt.cpp index b98d99692ba..4d73afc6fc5 100644 --- a/ACE/ace/Service_Gestalt.cpp +++ b/ACE/ace/Service_Gestalt.cpp @@ -83,7 +83,7 @@ ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard (void) // not to ignore any inactive services, since those may be forward // declarations size_t slot = 0; - int const ret = this->repo_.find_i (this->name_, slot, &tmp, false); + int const ret = this->repo_.find_i (this->name_, slot, &tmp, true); // We inserted it (as inactive), so we expect to find it, right? if ((ret < 0 && ret != -2) || tmp == 0) @@ -1231,14 +1231,14 @@ ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file) { if (*sptr == default_svc_conf && ignore_default_svc_conf_file) continue; - + int result = this->process_file (sptr->fast_rep ()); if (result < 0) return result; } - + return 0; - + } /* process_directives () */ // Tidy up and perform last rites on a terminating ACE_Service_Gestalt. diff --git a/ACE/ace/Service_Repository.cpp b/ACE/ace/Service_Repository.cpp index ee6c784df8f..36ba298d1e0 100644 --- a/ACE/ace/Service_Repository.cpp +++ b/ACE/ace/Service_Repository.cpp @@ -153,7 +153,6 @@ ACE_Service_Repository::fini (void) ACE_Service_Type *s = const_cast<ACE_Service_Type *> (this->service_vector_[i]); - #ifndef ACE_NLOGGING if (ACE::debug ()) { @@ -175,12 +174,6 @@ ACE_Service_Repository::fini (void) i, this->total_size_)); } - else - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] (%d) -> 0\n"), - this, - i, - this->total_size_)); #endif // Collect any errors. @@ -222,20 +215,17 @@ ACE_Service_Repository::close (void) if(ACE::debug ()) { if (s == 0) - { - if (s == 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d] -> 0\n"), - this, - i)); - else - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d], name=%s, object=%@\n"), - this, - i, - s->name (), - s)); - } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d] -> 0\n"), + this, + i)); + else + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d], name=%s, object=%@\n"), + this, + i, + s->name (), + s)); } #endif --this->current_size_; @@ -326,24 +316,46 @@ ACE_Service_Repository::relocate_i (size_t begin, ACE_Service_Type *type = const_cast<ACE_Service_Type *> (this->service_vector_[i]); - if (type == 0) continue; // skip any gaps - ACE_SHLIB_HANDLE old_handle = type->dll ().get_handle (0); - if (old_handle == ACE_SHLIB_INVALID_HANDLE && new_handle != old_handle) + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + { + if (type == 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d] (size=%d)") + ACE_TEXT (": skipping empty slot\n"), + this, + i, + this->total_size_)); + else + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d] (size=%d)") + ACE_TEXT (": trying name=%s, handle: %d -> %d\n"), + this, + i, + this->total_size_, + type->name (), + old_handle, + new_handle)); + } +#endif + + if (type != 0 // skip any gaps + && old_handle == ACE_SHLIB_INVALID_HANDLE + && new_handle != old_handle) { #ifndef ACE_NLOGGING if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE (%P|%t) SR::relocate - repo=%@ [%d] (size=%d)") - ACE_TEXT (": name=%s, handle: %d -> %d\n"), + ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d] (size=%d)") + ACE_TEXT (": relocating name=%s, handle: %d -> %d\n"), this, i, this->total_size_, type->name (), old_handle, new_handle)); -#else - ACE_UNUSED_ARG (new_handle); #endif type->dll (adll); // ups the refcount on adll } @@ -373,9 +385,9 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr) { ACE_TRACE ("ACE_Service_Repository::insert"); - int return_value = -1; - ACE_Service_Type *s = 0; size_t i = 0; + int return_value = -1; + ACE_Service_Type const *s = 0; // Establish scope for locking while manipulating the service // storage @@ -386,38 +398,42 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr) this->lock_, -1)); - // Check to see if this is a duplicate. - for (i = 0; i < this->current_size_; i++) - { - // Replacing an existing entry? - if (this->service_vector_[i] != 0 // skip any gaps - && ACE_OS::strcmp (sr->name (), this->service_vector_[i]->name ()) == 0) - { - return_value = 0; - - // Check for self-assignment... - if (sr != this->service_vector_[i]) - { - s = const_cast<ACE_Service_Type *> (this->service_vector_[i]); - this->service_vector_[i] = sr; - } - - break; - } - - break; - } + return_value = find_i (sr->name (), i, &s, false); // Adding an entry. - if (i >= this->total_size_) + if (s != 0) { - return_value = -1; // no space left + this->service_vector_[i] = sr; } - else if (s == 0) + else { - this->service_vector_[i] = sr; - this->current_size_++; - return_value = 0; + // New services are always added where current_size_ points, + // because if any DLL relocation needs to happen, it will be + // performed on services with indexes between some old + // current_size_ and the new current_size_ value. See + // ACE_Service_Type_Dynamic_Guard ctor and dtor for details. + + if (i < this->current_size_) + i = this->current_size_; + + if (i < this->total_size_) + { + this->service_vector_[i] = sr; + this->current_size_++; + return_value = 0; + } + else + { + return_value = -1; // no space left + } + + // Since there may be "holes" left by removed services one + // could consider wrapping current_size_ modulo + // total_size_. This is going to impact + // ACE_Service_Type_Dynamic_Guard, too and is tricky. Perhaps + // a new directive, like "reload" would be better as it can + // combine the removal and insertion in an atomic step and + // avoid creating too many "holes". } } #ifndef ACE_NLOGGING |