summaryrefslogtreecommitdiff
path: root/ACE/ace/Cleanup.h
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2008-12-03 07:57:38 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2008-12-03 07:57:38 +0000
commite1eb83702cfe1ebc7f7a5474449b336bc897907f (patch)
tree57616aae5ae0379bae7d22cc360fcbde9da4972b /ACE/ace/Cleanup.h
parent2930d7f4c50193600731490afcbb004465c26640 (diff)
downloadATCD-e1eb83702cfe1ebc7f7a5474449b336bc897907f.tar.gz
Wed Dec 3 07:55:00 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ACE/ace/Cleanup.h')
-rw-r--r--ACE/ace/Cleanup.h46
1 files changed, 29 insertions, 17 deletions
diff --git a/ACE/ace/Cleanup.h b/ACE/ace/Cleanup.h
index e3e55f4596a..0a158973729 100644
--- a/ACE/ace/Cleanup.h
+++ b/ACE/ace/Cleanup.h
@@ -27,6 +27,9 @@
#include /**/ "ace/ACE_export.h"
+# include "ace/Intrusive_List.h"
+# include "ace/Intrusive_List_Node.h"
+
#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# include "ace/Global_Macros.h"
# define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer)
@@ -59,27 +62,33 @@ extern "C" ACE_Export
void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0);
/**
- * @class ACE_Cleanup_Info
+ * @class ACE_Cleanup_Info_Node
+ *
+ * @brief For maintaining a list of ACE_Cleanup_Info items.
*
- * @brief Hold cleanup information for thread/process
+ * For internal use by ACE_Object_Manager.
*/
-class ACE_Export ACE_Cleanup_Info
+class ACE_Cleanup_Info_Node : public ACE_Intrusive_List_Node<ACE_Cleanup_Info_Node>
{
public:
- /// Constructor
- ACE_Cleanup_Info (void);
-
- /// Constructor.
- ACE_Cleanup_Info (void *object,
- ACE_CLEANUP_FUNC cleanup_hook,
- void *param);
+ ACE_Cleanup_Info_Node (void);
+ ACE_Cleanup_Info_Node (void *object,
+ ACE_CLEANUP_FUNC cleanup_hook,
+ void *param);
+ ~ACE_Cleanup_Info_Node (void);
/// Equality operator.
- bool operator== (const ACE_Cleanup_Info &o) const;
+ bool operator== (const ACE_Cleanup_Info_Node &o) const;
/// Inequality operator.
- bool operator!= (const ACE_Cleanup_Info &o) const;
+ bool operator!= (const ACE_Cleanup_Info_Node &o) const;
+
+ void* object(void);
+ ACE_CLEANUP_FUNC cleanup_hook (void);
+
+ void *param (void);
+private:
/// Point to object that gets passed into the <cleanup_hook_>.
void *object_;
@@ -90,7 +99,7 @@ public:
void *param_;
};
-class ACE_Cleanup_Info_Node;
+typedef ACE_Intrusive_List<ACE_Cleanup_Info_Node> ACE_Cleanup_Info_Node_List;
/**
* @class ACE_OS_Exit_Info
@@ -117,19 +126,22 @@ public:
/// registered, false if not.
bool find (void *object);
+ /// Remove a registered cleanup hook object. Returns true if removed
+ /// false if not.
+ bool remove (void *object);
+
/// Call all registered cleanup hooks, in reverse order of
/// registration.
void call_hooks ();
private:
/**
- * Keeps track of all registered objects. The last node is only
- * used to terminate the list (it doesn't contain a valid
- * ACE_Cleanup_Info).
+ * Keeps track of all registered objects.
*/
- ACE_Cleanup_Info_Node *registered_objects_;
+ ACE_Cleanup_Info_Node_List registered_objects_;
};
+
ACE_END_VERSIONED_NAMESPACE_DECL
# if defined (ACE_HAS_INLINED_OSCALLS)