1 #include "tao/Cleanup_Func_Registry.h"
3 #if !defined (__ACE_INLINE__)
4 # include "tao/Cleanup_Func_Registry.inl"
5 #endif /* __ACE_INLINE__ */
7 #include "ace/Log_Msg.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 TAO_Cleanup_Func_Registry::register_cleanup_function (ACE_CLEANUP_FUNC func
,
15 size_t const slot
= this->cleanup_funcs_
.size ();
17 if (this->cleanup_funcs_
.size (slot
+ 1) != 0)
20 this->cleanup_funcs_
[slot
] = func
;
27 TAO_Cleanup_Func_Registry::cleanup (ACE_Array_Base
<void *> &ts_objects
)
29 size_t const len
= ts_objects
.size ();
31 // The allocated slot may never have been used. It is therefore
32 // possible that the TSS array size may be less than the cleanup
33 // function size. However, there is still a one-to-one
34 // correspondence between cleanup_func[foo] and ts_object[foo].
36 ACE_ASSERT (len
<= this->cleanup_funcs_
.size ());
38 /// Cleanup each TSS object.
39 for (size_t i
= 0; i
< len
; ++i
)
41 ACE_CLEANUP_FUNC destructor
= this->cleanup_funcs_
[i
];
42 if (destructor
!= nullptr)
43 destructor (ts_objects
[i
], nullptr);
47 TAO_END_VERSIONED_NAMESPACE_DECL