Fixed typos
[ACE_TAO.git] / ACE / ace / Dynamic_Service_Dependency.h
blobbb5294f408e074229add4305ec58823e65db51f2
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Dynamic_Service_Dependency.h
7 * @author Iliyan Jeliazkov <iliyan@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef ACE_DYNAMIC_SERVICE_DEPENDENCY_H
12 #define ACE_DYNAMIC_SERVICE_DEPENDENCY_H
14 #include /**/ "ace/pre.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Dynamic_Service_Base.h"
22 #include "ace/Service_Object.h"
23 #include "ace/DLL.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 /**
28 * @class ACE_Dynamic_Service_Dependency
30 * @brief Provides a way to declare dependency on specific service,
31 * thus helping to avoid order of initialization issues with instances
32 * of an objects whose implementation code resides in dynamically loaded
33 * services.
35 * It is disastrous to have dynamically loadable services create and give away
36 * ownership of objects and then ending up being unloaded before all those
37 * instances have been deleted. Normally the code for such objects classes
38 * resides within the TEXT segment of the DLL, which implements the service.
39 * If a service gets removed, its DLL may be unmapped from memory and then
40 * any attempt to invoke a method on the said objects will cause SEGV.
42 * Such instances must contain a member of ACE_Dynamic_Service_Dependency
43 * initialized with the service they depend on.
44 * ACE_Dynamic_Service_Dependency's constructor and destructor are
45 * "magical" - they work by maintaining the underlying dynamic service's
46 * DLL reference count.
48 class ACE_Export ACE_Dynamic_Service_Dependency
50 public:
51 ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg,
52 const ACE_TCHAR *principal);
53 ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal);
54 ~ACE_Dynamic_Service_Dependency (void);
56 private:
57 void init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal);
59 private:
60 ACE_DLL tracker_;
63 ACE_END_VERSIONED_NAMESPACE_DECL
66 #include /**/ "ace/post.h"
68 #endif /* ACE_DYNAMIC_SERVICE_DEPENDENCY_H */