mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10643] Update the ACE part we use to 5.8.2
Signed-off-by: Neo2003 <Neo.2003@Hotmail.fr>
This commit is contained in:
parent
8f71d95c0d
commit
23c920ca4b
739 changed files with 22031 additions and 40373 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// $Id: Service_Repository.cpp 81388 2008-04-23 14:02:05Z johnnyw $
|
||||
// $Id: Service_Repository.cpp 91286 2010-08-05 09:04:31Z johnnyw $
|
||||
|
||||
#include "ace/Service_Repository.h"
|
||||
|
||||
|
|
@ -14,19 +14,15 @@
|
|||
#include "ace/OS_NS_errno.h"
|
||||
#include "ace/OS_NS_string.h"
|
||||
|
||||
ACE_RCSID (ace,
|
||||
Service_Repository,
|
||||
"$Id: Service_Repository.cpp 81388 2008-04-23 14:02:05Z johnnyw $")
|
||||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository)
|
||||
|
||||
// Process-wide Service Repository.
|
||||
/// Process-wide Service Repository.
|
||||
ACE_Service_Repository *ACE_Service_Repository::svc_rep_ = 0;
|
||||
|
||||
// Controls whether the Service_Repository is deleted when we shut
|
||||
// down (we can only delete it safely if we created it)!
|
||||
/// Controls whether the Service_Repository is deleted when we shut
|
||||
/// down (we can only delete it safely if we created it)!
|
||||
bool ACE_Service_Repository::delete_svc_rep_ = false;
|
||||
|
||||
void
|
||||
|
|
@ -37,16 +33,8 @@ ACE_Service_Repository::dump (void) const
|
|||
#endif /* ACE_HAS_DUMP */
|
||||
}
|
||||
|
||||
ACE_Service_Repository::ACE_Service_Repository (void)
|
||||
: service_vector_ (0),
|
||||
current_size_ (0),
|
||||
total_size_ (0)
|
||||
{
|
||||
ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository");
|
||||
}
|
||||
|
||||
ACE_Service_Repository *
|
||||
ACE_Service_Repository::instance (size_t size /* = ACE_Service_Repository::DEFAULT_SIZE */)
|
||||
ACE_Service_Repository::instance (size_t size)
|
||||
{
|
||||
ACE_TRACE ("ACE_Service_Repository::instance");
|
||||
|
||||
|
|
@ -102,36 +90,27 @@ ACE_Service_Repository::close_singleton (void)
|
|||
}
|
||||
}
|
||||
|
||||
// Initialize the Repository to a clean slate.
|
||||
|
||||
/// Initialize the Repository to a clean slate.
|
||||
int
|
||||
ACE_Service_Repository::open (size_t size)
|
||||
{
|
||||
ACE_TRACE ("ACE_Service_Repository::open");
|
||||
|
||||
ACE_Service_Type **temp = 0;
|
||||
// Create a new array and swap it with the local array
|
||||
array_type local_array (size);
|
||||
this->service_array_.swap (local_array);
|
||||
|
||||
ACE_NEW_RETURN (temp,
|
||||
ACE_Service_Type *[size],
|
||||
-1);
|
||||
|
||||
this->service_vector_ = const_cast<const ACE_Service_Type **> (temp);
|
||||
this->total_size_ = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACE_Service_Repository::ACE_Service_Repository (size_t size)
|
||||
: current_size_ (0)
|
||||
: service_array_ (size)
|
||||
{
|
||||
ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository");
|
||||
|
||||
if (this->open (size) == -1)
|
||||
ACE_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_Service_Repository")));
|
||||
}
|
||||
|
||||
// Finalize (call <fini> and possibly delete) all the services.
|
||||
|
||||
/// Finalize (call fini() and possibly delete) all the services.
|
||||
|
||||
int
|
||||
ACE_Service_Repository::fini (void)
|
||||
|
|
@ -139,102 +118,138 @@ ACE_Service_Repository::fini (void)
|
|||
ACE_TRACE ("ACE_Service_Repository::fini");
|
||||
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
|
||||
|
||||
if (this->service_vector_ == 0)
|
||||
return 0;
|
||||
|
||||
int retval = 0;
|
||||
|
||||
// Do not be tempted to use the prefix decrement operator. Use
|
||||
// postfix decrement operator since the index is unsigned and may
|
||||
// wrap around the 0
|
||||
for (size_t i = this->current_size_; i-- != 0; )
|
||||
//
|
||||
// debug output for empty service entries
|
||||
#ifndef ACE_NLOGGING
|
||||
if (ACE::debug ())
|
||||
{
|
||||
for (size_t i = this->service_array_.size (); i-- != 0;)
|
||||
{
|
||||
// <fini> the services in reverse order.
|
||||
ACE_Service_Type *s =
|
||||
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
|
||||
const_cast<ACE_Service_Type *> (this->service_array_[i]);
|
||||
if (s == 0)
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] -> 0\n"),
|
||||
this,
|
||||
i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// Remove all the Service_Object and Stream instances
|
||||
//
|
||||
for (size_t i = this->service_array_.size (); i-- != 0;)
|
||||
{
|
||||
// <fini> the services in reverse order.
|
||||
ACE_Service_Type *s =
|
||||
const_cast<ACE_Service_Type *> (this->service_array_[i]);
|
||||
|
||||
if (s != 0 &&
|
||||
s->type () != 0 &&
|
||||
(s->type ()->service_type () != ACE_Service_Type::MODULE))
|
||||
{
|
||||
#ifndef ACE_NLOGGING
|
||||
if (ACE::debug ())
|
||||
{
|
||||
if (s != 0)
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] (%d), ")
|
||||
ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_,
|
||||
s->name(),
|
||||
s->type (),
|
||||
(s->type () != 0) ? s->type ()->object () : 0,
|
||||
s->active ()));
|
||||
else
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] (%d) -> 0\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_));
|
||||
}
|
||||
{
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ")
|
||||
ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
|
||||
this,
|
||||
i,
|
||||
s->name (),
|
||||
s->type (),
|
||||
(s->type () != 0) ? s->type ()->object () : 0,
|
||||
s->active ()));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Collect any errors.
|
||||
if (s != 0)
|
||||
retval += s->fini ();
|
||||
retval += s->fini ();
|
||||
}
|
||||
}
|
||||
//
|
||||
// Remove all the Module instances
|
||||
//
|
||||
for (size_t i = this->service_array_.size (); i-- != 0;)
|
||||
{
|
||||
// <fini> the services in reverse order.
|
||||
ACE_Service_Type *s =
|
||||
const_cast<ACE_Service_Type *> (this->service_array_[i]);
|
||||
|
||||
if (s != 0 &&
|
||||
s->type () != 0 &&
|
||||
(s->type ()->service_type () == ACE_Service_Type::MODULE))
|
||||
{
|
||||
#ifndef ACE_NLOGGING
|
||||
if (ACE::debug ())
|
||||
{
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ")
|
||||
ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
|
||||
this,
|
||||
i,
|
||||
s->name (),
|
||||
s->type (),
|
||||
(s->type () != 0) ? s->type ()->object () : 0,
|
||||
s->active ()));
|
||||
}
|
||||
#endif
|
||||
// Collect any errors.
|
||||
retval += s->fini ();
|
||||
}
|
||||
}
|
||||
return (retval == 0) ? 0 : -1;
|
||||
}
|
||||
|
||||
// Close down all the services.
|
||||
|
||||
/// Close down all the services.
|
||||
int
|
||||
ACE_Service_Repository::close (void)
|
||||
{
|
||||
ACE_TRACE ("ACE_Service_Repository::close");
|
||||
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
|
||||
|
||||
if (this->service_vector_ == 0)
|
||||
return 0;
|
||||
|
||||
#ifndef ACE_NLOGGING
|
||||
if(ACE::debug ())
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("(%P|%t) SR::close - repo=%@, size=%d\n"),
|
||||
ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@, size=%d\n"),
|
||||
this,
|
||||
this->current_size_));
|
||||
this->service_array_.size()));
|
||||
#endif
|
||||
|
||||
// Do not use the prefix decrement operator since the index is
|
||||
// unsigned and may wrap around the 0.
|
||||
for (size_t i = this->current_size_; i-- != 0; )
|
||||
for (size_t i = this->service_array_.size(); i-- != 0; )
|
||||
{
|
||||
// Delete services in reverse order.
|
||||
ACE_Service_Type *s =
|
||||
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
|
||||
const_cast<ACE_Service_Type *> (this->service_array_[i]);
|
||||
|
||||
#ifndef ACE_NLOGGING
|
||||
if(ACE::debug ())
|
||||
{
|
||||
if (s == 0)
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d] -> 0\n"),
|
||||
ACE_TEXT ("ACE (%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"),
|
||||
ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@ [%d], name=%s, object=%@\n"),
|
||||
this,
|
||||
i,
|
||||
s->name (),
|
||||
s));
|
||||
}
|
||||
#endif
|
||||
--this->current_size_;
|
||||
delete s;
|
||||
}
|
||||
|
||||
delete [] this->service_vector_;
|
||||
this->service_vector_ = 0;
|
||||
this->current_size_ = 0;
|
||||
this->service_array_.clear ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -244,18 +259,17 @@ ACE_Service_Repository::~ACE_Service_Repository (void)
|
|||
ACE_TRACE ("ACE_Service_Repository::~ACE_Service_Repository");
|
||||
#ifndef ACE_NLOGGING
|
||||
if(ACE::debug ())
|
||||
ACE_DEBUG ((LM_DEBUG, "(%P|%t) SR::<dtor>, this=%@\n", this));
|
||||
ACE_DEBUG ((LM_DEBUG, "ACE (%P|%t) SR::<dtor>, this=%@\n", this));
|
||||
#endif
|
||||
this->close ();
|
||||
}
|
||||
|
||||
// Locate an entry with <name> in the table. If <ignore_suspended> is
|
||||
// set then only consider services marked as resumed. If the caller
|
||||
// wants the located entry, pass back a pointer to the located entry
|
||||
// via <srp>. If <name> is not found -1 is returned. If <name> is
|
||||
// found, but it is suspended and the caller wants to ignore suspended
|
||||
// services a -2 is returned. Must be called with locks held.
|
||||
|
||||
/// Locate an entry with @a name in the table. If @a ignore_suspended is
|
||||
/// set then only consider services marked as resumed. If the caller
|
||||
/// wants the located entry, pass back a pointer to the located entry
|
||||
/// via @a srp. If @a name is not found -1 is returned. If @a name is
|
||||
/// found, but it is suspended and the caller wants to ignore suspended
|
||||
/// services a -2 is returned. Must be called with locks held.
|
||||
int
|
||||
ACE_Service_Repository::find_i (const ACE_TCHAR name[],
|
||||
size_t &slot,
|
||||
|
|
@ -263,20 +277,25 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[],
|
|||
bool ignore_suspended) const
|
||||
{
|
||||
ACE_TRACE ("ACE_Service_Repository::find_i");
|
||||
size_t i;
|
||||
size_t i = 0;
|
||||
array_type::const_iterator element = this->service_array_.end ();
|
||||
|
||||
for (i = 0; i < this->current_size_; i++)
|
||||
for (i = 0; i < this->service_array_.size(); i++)
|
||||
{
|
||||
if (this->service_vector_[i] != 0 // skip any empty slots
|
||||
&& ACE_OS::strcmp (name,
|
||||
this->service_vector_[i]->name ()) == 0)
|
||||
array_type::const_iterator iter = this->service_array_.find (i);
|
||||
if (iter != this->service_array_.end ()
|
||||
&& (*iter).second != 0 // skip any empty slots
|
||||
&& ACE_OS::strcmp (name, (*iter).second->name ()) == 0)
|
||||
{
|
||||
element = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < this->current_size_)
|
||||
if (element != this->service_array_.end ())
|
||||
{
|
||||
slot = i;
|
||||
if (this->service_vector_[i]->fini_called ())
|
||||
if ((*element).second->fini_called ())
|
||||
{
|
||||
if (srp != 0)
|
||||
*srp = 0;
|
||||
|
|
@ -284,10 +303,10 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[],
|
|||
}
|
||||
|
||||
if (srp != 0)
|
||||
*srp = this->service_vector_[i];
|
||||
*srp = (*element).second;
|
||||
|
||||
if (ignore_suspended
|
||||
&& this->service_vector_[i]->active () == 0)
|
||||
&& (*element).second->active () == 0)
|
||||
return -2;
|
||||
|
||||
return 0;
|
||||
|
|
@ -303,7 +322,6 @@ ACE_Service_Repository::find_i (const ACE_TCHAR name[],
|
|||
/// DLL. No locking, caller makes sure calling it is safe. You can
|
||||
/// forcefully relocate any DLLs in the given range, not only the
|
||||
/// static ones - but that will cause Very Bad Things (tm) to happen.
|
||||
|
||||
int
|
||||
ACE_Service_Repository::relocate_i (size_t begin,
|
||||
size_t end,
|
||||
|
|
@ -314,7 +332,7 @@ ACE_Service_Repository::relocate_i (size_t begin,
|
|||
for (size_t i = begin; i < end; i++)
|
||||
{
|
||||
ACE_Service_Type *type =
|
||||
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
|
||||
const_cast<ACE_Service_Type *> (this->service_array_[i]);
|
||||
|
||||
ACE_SHLIB_HANDLE old_handle = (type == 0) ? ACE_SHLIB_INVALID_HANDLE
|
||||
: type->dll ().get_handle (0);
|
||||
|
|
@ -324,18 +342,16 @@ ACE_Service_Repository::relocate_i (size_t begin,
|
|||
{
|
||||
if (type == 0)
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d] (size=%d)")
|
||||
ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d]")
|
||||
ACE_TEXT (": skipping empty slot\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_));
|
||||
i));
|
||||
else
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d] (size=%d)")
|
||||
ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d]")
|
||||
ACE_TEXT (": trying name=%s, handle: %d -> %d\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_,
|
||||
type->name (),
|
||||
old_handle,
|
||||
new_handle));
|
||||
|
|
@ -349,11 +365,10 @@ ACE_Service_Repository::relocate_i (size_t begin,
|
|||
#ifndef ACE_NLOGGING
|
||||
if (ACE::debug ())
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d] (size=%d)")
|
||||
ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d]")
|
||||
ACE_TEXT (": relocating name=%s, handle: %d -> %d\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_,
|
||||
type->name (),
|
||||
old_handle,
|
||||
new_handle));
|
||||
|
|
@ -376,11 +391,10 @@ ACE_Service_Repository::find (const ACE_TCHAR name[],
|
|||
return this->find_i (name, ignore_location, srp, ignore_suspended);
|
||||
}
|
||||
|
||||
|
||||
// Insert the ACE_Service_Type SR into the repository. Note that
|
||||
// services may be inserted either resumed or suspended. Using same
|
||||
// name as in an existing service causes the delete () to be called
|
||||
// for the old one, i.e. make sure @code sr is allocated on the heap!
|
||||
/// Insert the ACE_Service_Type SR into the repository. Note that
|
||||
/// services may be inserted either resumed or suspended. Using same
|
||||
/// name as in an existing service causes the delete () to be called
|
||||
/// for the old one, i.e. make sure @code sr is allocated on the heap!
|
||||
int
|
||||
ACE_Service_Repository::insert (const ACE_Service_Type *sr)
|
||||
{
|
||||
|
|
@ -404,7 +418,7 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
|
|||
// Adding an entry.
|
||||
if (s != 0)
|
||||
{
|
||||
this->service_vector_[i] = sr;
|
||||
this->service_array_[i] = sr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -414,37 +428,20 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
|
|||
// 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->service_array_.size ())
|
||||
i = this->service_array_.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".
|
||||
this->service_array_[i] = sr;
|
||||
return_value = 0;
|
||||
}
|
||||
}
|
||||
#ifndef ACE_NLOGGING
|
||||
if (ACE::debug ())
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::insert - repo=%@ [%d] (%d),")
|
||||
ACE_TEXT (" name=%s (%s) (type=%@, object=%@, active=%d)\n"),
|
||||
ACE_TEXT ("ACE (%P|%t) SR::insert - repo=%@ [%d],")
|
||||
ACE_TEXT (" name=%s (%C) (type=%@, object=%@, active=%d)\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_,
|
||||
sr->name(),
|
||||
(return_value == 0 ? ((s==0) ? "new" : "replacing") : "failed"),
|
||||
sr->type (),
|
||||
|
|
@ -462,7 +459,7 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
|
|||
return return_value;
|
||||
}
|
||||
|
||||
// Resume a service that was previously suspended.
|
||||
/// Resume a service that was previously suspended.
|
||||
int
|
||||
ACE_Service_Repository::resume (const ACE_TCHAR name[],
|
||||
const ACE_Service_Type **srp)
|
||||
|
|
@ -474,12 +471,11 @@ ACE_Service_Repository::resume (const ACE_TCHAR name[],
|
|||
if (-1 == this->find_i (name, i, srp, 0))
|
||||
return -1;
|
||||
|
||||
return this->service_vector_[i]->resume ();
|
||||
return this->service_array_[i]->resume ();
|
||||
}
|
||||
|
||||
// Suspend a service so that it will not be considered active under
|
||||
// most circumstances by other portions of the ACE_Service_Repository.
|
||||
|
||||
/// Suspend a service so that it will not be considered active under
|
||||
/// most circumstances by other portions of the ACE_Service_Repository.
|
||||
int
|
||||
ACE_Service_Repository::suspend (const ACE_TCHAR name[],
|
||||
const ACE_Service_Type **srp)
|
||||
|
|
@ -490,15 +486,13 @@ ACE_Service_Repository::suspend (const ACE_TCHAR name[],
|
|||
if (-1 == this->find_i (name, i, srp, 0))
|
||||
return -1;
|
||||
|
||||
return this->service_vector_[i]->suspend ();
|
||||
return this->service_array_[i]->suspend ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Completely remove a <name> entry from the Repository and
|
||||
* @brief Completely remove a @a name entry from the Repository and
|
||||
* dynamically unlink it if it was originally dynamically linked.
|
||||
*/
|
||||
|
||||
int
|
||||
ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps)
|
||||
{
|
||||
|
|
@ -520,7 +514,7 @@ ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Completely remove a <name> entry from the Repository and
|
||||
* @brief Completely remove a @a name entry from the Repository and
|
||||
* dynamically unlink it if it was originally dynamically linked.
|
||||
*
|
||||
* Return a ptr to the entry in @code ps. There is no locking so make
|
||||
|
|
@ -528,7 +522,7 @@ ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps)
|
|||
*
|
||||
* Since the order of services in the Respository matters, we can't
|
||||
* simply overwrite the entry being deleted with the last and
|
||||
* decrement the <current_size> by 1. A good example of why the order
|
||||
* decrement the @c current_size by 1. A good example of why the order
|
||||
* matters is a dynamic service, in whose DLL there is at least one
|
||||
* static service. In order to prevent SEGV during finalization, those
|
||||
* static services must be finalized _before_the dynamic service that
|
||||
|
|
@ -547,22 +541,21 @@ ACE_Service_Repository::remove_i (const ACE_TCHAR name[], ACE_Service_Type **ps)
|
|||
return -1; // Not found
|
||||
|
||||
// We may need the old ptr - to be delete outside the lock!
|
||||
*ps = const_cast<ACE_Service_Type *> (this->service_vector_[i]);
|
||||
*ps = const_cast<ACE_Service_Type *> (this->service_array_[i]);
|
||||
|
||||
#ifndef ACE_NLOGGING
|
||||
if (ACE::debug ())
|
||||
ACE_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) SR::remove_i - repo=%@ [%d] (%d),")
|
||||
ACE_TEXT ("ACE (%P|%t) SR::remove_i - repo=%@ [%d],")
|
||||
ACE_TEXT (" name=%s (removed) (type=%@, active=%d)\n"),
|
||||
this,
|
||||
i,
|
||||
this->total_size_,
|
||||
name,
|
||||
*ps,
|
||||
(*ps)->active ()));
|
||||
#endif
|
||||
|
||||
this->service_vector_[i] = 0; // simply leave a gap
|
||||
this->service_array_[i] = 0; // simply leave a gap
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -576,24 +569,21 @@ ACE_Service_Repository_Iterator::dump (void) const
|
|||
#endif /* ACE_HAS_DUMP */
|
||||
}
|
||||
|
||||
|
||||
// Initializes the iterator and skips over any suspended entries at
|
||||
// the beginning of the table, if necessary. Note, you must not
|
||||
// perform destructive operations on elements during this iteration...
|
||||
|
||||
/// Initializes the iterator and skips over any suspended entries at
|
||||
/// the beginning of the table, if necessary. Note, you must not
|
||||
/// perform destructive operations on elements during this iteration...
|
||||
ACE_Service_Repository_Iterator::ACE_Service_Repository_Iterator
|
||||
(ACE_Service_Repository &sr, int ignr_suspended)
|
||||
(ACE_Service_Repository &sr, bool ignored_suspended)
|
||||
: svc_rep_ (sr),
|
||||
next_ (0),
|
||||
ignore_suspended_ (ignr_suspended)
|
||||
ignore_suspended_ (ignored_suspended)
|
||||
{
|
||||
while (!(done() || valid()))
|
||||
this->next_++;
|
||||
}
|
||||
|
||||
// Obtains a pointer to the next valid service in the table. If there
|
||||
// are no more entries, returns 0, else 1.
|
||||
|
||||
/// Obtains a pointer to the next valid service in the table. If there
|
||||
/// are no more entries, returns 0, else 1.
|
||||
int
|
||||
ACE_Service_Repository_Iterator::next (const ACE_Service_Type *&sr)
|
||||
{
|
||||
|
|
@ -602,15 +592,14 @@ ACE_Service_Repository_Iterator::next (const ACE_Service_Type *&sr)
|
|||
if (done ())
|
||||
return 0;
|
||||
|
||||
sr = this->svc_rep_.service_vector_[this->next_];
|
||||
sr = this->svc_rep_.service_array_[this->next_];
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Advance the iterator by the proper amount. If we are ignoring
|
||||
// suspended entries and the current entry is suspended, then we must
|
||||
// skip over this entry. Otherwise, we must advance the NEXT index to
|
||||
// reference the next valid service entry.
|
||||
|
||||
/// Advance the iterator by the proper amount. If we are ignoring
|
||||
/// suspended entries and the current entry is suspended, then we must
|
||||
/// skip over this entry. Otherwise, we must advance the NEXT index to
|
||||
/// reference the next valid service entry.
|
||||
int
|
||||
ACE_Service_Repository_Iterator::advance (void)
|
||||
{
|
||||
|
|
@ -628,10 +617,10 @@ ACE_Service_Repository_Iterator::valid (void) const
|
|||
{
|
||||
ACE_TRACE ("ACE_Service_Repository_Iterator::valid");
|
||||
if (!this->ignore_suspended_)
|
||||
return (this->svc_rep_.service_vector_[this->next_] != 0); // skip over gaps
|
||||
return (this->svc_rep_.service_array_[this->next_] != 0); // skip over gaps
|
||||
|
||||
return (this->svc_rep_.service_vector_[this->next_] != 0
|
||||
&& this->svc_rep_.service_vector_[this->next_]->active ());
|
||||
return (this->svc_rep_.service_array_[this->next_] != 0
|
||||
&& this->svc_rep_.service_array_[this->next_]->active ());
|
||||
}
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue