#include <Dynamic_Service_Dependency.h>
Collaboration diagram for ACE_Dynamic_Service_Dependency:
Public Member Functions | |
ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal) | |
ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal) | |
~ACE_Dynamic_Service_Dependency (void) | |
Private Member Functions | |
void | init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal) |
Private Attributes | |
ACE_DLL | tracker_ |
It is disastrous to have dynamically loadable services create and give away ownership of objects and then ending up being unloaded before all those instances have been deleted. Normally the code for such objects classes resides within the TEXT segment of the DLL, which implements the service. If a service gets removed, its DLL may be unmapped from memory and then any attempt to invoke a method on the said objects will cause SEGV.
Such instances must contain a member of ACE_Dynamic_Service_Dependency initialized with the service they depend on. ACE_Dynamic_Service_Dependency's constructor and destructor are "magical" - they work by maintaining the underlying dynamic service's DLL reference count.
Definition at line 50 of file Dynamic_Service_Dependency.h.
|
Definition at line 20 of file Dynamic_Service_Dependency.cpp. References ACE_TCHAR, and init().
00022 { 00023 this->init (cfg, principal); 00024 } |
|
Definition at line 15 of file Dynamic_Service_Dependency.cpp. References ACE_TCHAR, and init().
00016 { 00017 this->init (ACE_Service_Config::current (), principal); 00018 } |
|
Definition at line 27 of file Dynamic_Service_Dependency.cpp. References ACE_DEBUG, ACE_TEXT, ACE::debug(), and LM_DEBUG.
00028 { 00029 if (ACE::debug ()) 00030 ACE_DEBUG ((LM_DEBUG, 00031 ACE_TEXT ("(%P|%t) DSD, this=%@ - destroying\n"), 00032 this)); 00033 } |
|
Definition at line 36 of file Dynamic_Service_Dependency.cpp. References ACE_DEBUG, ACE_TCHAR, ACE_TEXT, ACE::debug(), ACE_Service_Type::dll(), ACE_Service_Type::dump(), ACE_Dynamic_Service_Base::find_i(), LM_DEBUG, and tracker_. Referenced by ACE_Dynamic_Service_Dependency().
00038 { 00039 const ACE_Service_Type* st = 00040 ACE_Dynamic_Service_Base::find_i (cfg, principal,false); 00041 if (ACE::debug ()) 00042 { 00043 ACE_DEBUG ((LM_DEBUG, 00044 ACE_TEXT ("(%P|%t) DSD, this=%@ - creating dependency on "), this)); 00045 st->dump (); 00046 } 00047 this->tracker_ = st->dll (); 00048 } |
|
Definition at line 62 of file Dynamic_Service_Dependency.h. Referenced by init(). |