*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
//==========================================================================
|
||||
/**
|
||||
* @file TSS_T.h
|
||||
@@ -11,17 +10,13 @@
|
||||
* @author Douglas C. Schmidt <[email protected]>
|
||||
*/
|
||||
//==========================================================================
|
||||
|
||||
#ifndef ACE_TSS_T_H
|
||||
#define ACE_TSS_T_H
|
||||
#include /**/ "ace/pre.h"
|
||||
|
||||
#include "ace/Lock.h"
|
||||
|
||||
#if !defined (ACE_LACKS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif /* ACE_LACKS_PRAGMA_ONCE */
|
||||
|
||||
// This should probably go somewhere else, but it's only used here and
|
||||
// in Thread_Manager.
|
||||
// Note there is no ACE_TSS_SET because one would typicaly do
|
||||
@@ -34,11 +29,8 @@
|
||||
# define ACE_TSS_TYPE(T) T
|
||||
# define ACE_TSS_GET(I, T) (I)
|
||||
# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */
|
||||
|
||||
#include "ace/Thread_Mutex.h"
|
||||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
/**
|
||||
* @class ACE_TSS
|
||||
*
|
||||
@@ -89,11 +81,9 @@ public:
|
||||
* a specific value.
|
||||
*/
|
||||
ACE_TSS (TYPE *ts_obj = 0);
|
||||
|
||||
/// Deregister this object from thread-specific storage administration.
|
||||
/// Will cause all threads' copies of TYPE to be destroyed.
|
||||
virtual ~ACE_TSS (void);
|
||||
|
||||
/**
|
||||
* Set the thread-specific object for the calling thread.
|
||||
* If this object has not been initialized yet, this method performs the
|
||||
@@ -110,7 +100,6 @@ public:
|
||||
* value if ts_object() returns 0.
|
||||
*/
|
||||
TYPE *ts_object (TYPE *new_ts_obj);
|
||||
|
||||
/** @name Accessors
|
||||
*
|
||||
* All accessors return a pointer to the calling thread's copy of the
|
||||
@@ -128,7 +117,6 @@ public:
|
||||
* information.
|
||||
*/
|
||||
TYPE *ts_object (void) const;
|
||||
|
||||
/**
|
||||
* Use a "smart pointer" to get the thread-specific data associated
|
||||
* with this object.
|
||||
@@ -142,7 +130,6 @@ public:
|
||||
* information.
|
||||
*/
|
||||
TYPE *operator-> () const;
|
||||
|
||||
/**
|
||||
* Obtain a pointer to the calling thread's TYPE object.
|
||||
* If this ACE_TSS object hasn't been initialized, this method
|
||||
@@ -155,42 +142,31 @@ public:
|
||||
* information.
|
||||
*/
|
||||
operator TYPE *(void) const;
|
||||
|
||||
//@}
|
||||
|
||||
/// Hook for construction parameters.
|
||||
virtual TYPE *make_TSS_TYPE (void) const;
|
||||
|
||||
// = Utility methods.
|
||||
|
||||
/// Dump the state of an object.
|
||||
void dump (void) const;
|
||||
|
||||
// ACE_ALLOC_HOOK_DECLARE;
|
||||
// Declare the dynamic allocation hooks.
|
||||
|
||||
protected:
|
||||
/// Actually implements the code that retrieves the object from
|
||||
/// thread-specific storage.
|
||||
TYPE *ts_get (void) const;
|
||||
|
||||
/// Factors out common code for initializing TSS. This must NOT be
|
||||
/// called with the lock held...
|
||||
int ts_init (void);
|
||||
|
||||
#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)))
|
||||
/// This implementation only works for non-threading systems...
|
||||
TYPE *type_;
|
||||
#else
|
||||
/// Avoid race conditions during initialization.
|
||||
ACE_Thread_Mutex keylock_;
|
||||
|
||||
/// "First time in" flag.
|
||||
volatile bool once_;
|
||||
|
||||
/// Key for the thread-specific error data.
|
||||
ACE_thread_key_t key_;
|
||||
|
||||
/// "Destructor" that deletes internal TYPE * when thread exits.
|
||||
static void cleanup (void *ptr);
|
||||
#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */
|
||||
@@ -198,7 +174,6 @@ protected:
|
||||
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS<TYPE> &))
|
||||
ACE_UNIMPLEMENTED_FUNC (ACE_TSS (const ACE_TSS<TYPE> &))
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ACE_TSS_Type_Adapter
|
||||
*
|
||||
@@ -221,34 +196,26 @@ class ACE_TSS_Type_Adapter
|
||||
public:
|
||||
/// Constructor. Inlined here so that it should _always_ be inlined.
|
||||
ACE_TSS_Type_Adapter (const TYPE value = 0): value_ (value) {}
|
||||
|
||||
/// TYPE conversion. Inlined here so that it should _always_ be
|
||||
/// inlined.
|
||||
operator TYPE () const { return value_; };
|
||||
|
||||
/// TYPE & conversion. Inlined here so that it should _always_ be
|
||||
/// inlined.
|
||||
operator TYPE &() { return value_; };
|
||||
|
||||
private:
|
||||
/// The wrapped value.
|
||||
TYPE value_;
|
||||
};
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
#if defined (__ACE_INLINE__)
|
||||
#include "ace/TSS_T.inl"
|
||||
#endif /* __ACE_INLINE__ */
|
||||
|
||||
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
|
||||
#include "ace/TSS_T.cpp"
|
||||
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
|
||||
|
||||
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
|
||||
#pragma implementation ("TSS_T.cpp")
|
||||
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
|
||||
|
||||
#include /**/ "ace/post.h"
|
||||
#endif /* ACE_TSS_T_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user