#include <Cleanup_Func_Registry.h>
Collaboration diagram for TAO_Cleanup_Func_Registry:
Public Member Functions | |
TAO_Cleanup_Func_Registry (void) | |
Constructor. | |
size_t | size (void) const |
Return the number of registered cleanup functions. | |
Protected Member Functions | |
int | register_cleanup_function (ACE_CLEANUP_FUNC func, size_t &slot_id) |
void | cleanup (ACE_Array_Base< void * > &ts_objects) |
Private Member Functions | |
TAO_Cleanup_Func_Registry (const TAO_Cleanup_Func_Registry &) | |
void | operator= (const TAO_Cleanup_Func_Registry &) |
Private Attributes | |
ACE_Array_Base< ACE_CLEANUP_FUNC > | cleanup_funcs_ |
Friends | |
class | TAO_ORB_Core |
Definition at line 40 of file Cleanup_Func_Registry.h.
|
Constructor.
Definition at line 8 of file Cleanup_Func_Registry.inl.
00009 : cleanup_funcs_ () 00010 { 00011 } |
|
Prevent copying through the copy constructor and the assignment operator. |
|
Invoke the corresponding cleanup function on each thread-specific object. Definition at line 32 of file Cleanup_Func_Registry.cpp. References ACE_ASSERT, ACE_CLEANUP_FUNC, cleanup_funcs_, ACE_Array_Base< ACE_CLEANUP_FUNC >::size(), and ACE_Array_Base< T >::size().
00033 { 00034 size_t const len = ts_objects.size (); 00035 00036 // The allocated slot may never have been used. It is therefore 00037 // possible that the TSS array size may be less than the cleanup 00038 // function size. However, there is still a one-to-one 00039 // correspondence between cleanup_func[foo] and ts_object[foo]. 00040 00041 ACE_ASSERT (len <= this->cleanup_funcs_.size ()); 00042 00043 /// Cleanup each TSS object. 00044 for (size_t i = 0; i < len; ++i) 00045 { 00046 ACE_CLEANUP_FUNC destructor = this->cleanup_funcs_[i]; 00047 if (destructor != 0) 00048 destructor (ts_objects[i], 0); 00049 } 00050 } |
|
|
|
Register a cleanup function. The number of slot the cleanup function is placed is in will match the one reserved for the corresponding thread specific object in the ORB Core TSS resources. The slot_id is returned via the second reference argument. This method returns 0 on failure, and -1 on failure. Definition at line 16 of file Cleanup_Func_Registry.cpp. References cleanup_funcs_, and ACE_Array_Base< ACE_CLEANUP_FUNC >::size(). Referenced by TAO_ORB_Core::add_tss_cleanup_func().
00019 { 00020 size_t const slot = this->cleanup_funcs_.size (); 00021 00022 if (this->cleanup_funcs_.size (slot + 1) != 0) 00023 return -1; 00024 00025 this->cleanup_funcs_[slot] = func; 00026 slot_id = slot; 00027 00028 return 0; 00029 } |
|
Return the number of registered cleanup functions.
Definition at line 14 of file Cleanup_Func_Registry.inl. References cleanup_funcs_, and ACE_Array_Base< ACE_CLEANUP_FUNC >::size(). Referenced by TAO_ORB_Core::set_tss_resource().
00015 { 00016 return this->cleanup_funcs_.size (); 00017 } |
|
Definition at line 42 of file Cleanup_Func_Registry.h. |
|
Array of registered cleanup functions. The number of registered cleanup functions should be the same as the number of registered thread-specific objects in the ORB Core TSS resources. Definition at line 79 of file Cleanup_Func_Registry.h. Referenced by cleanup(), register_cleanup_function(), and size(). |