Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / dep / ACE_wrappers / ace / Dynamic_Service_Dependency.h
blob0f187d0037a97297cfde02220f4f9e089e68415d
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Dynamic_Service_Dependency.h
7 * $Id: Dynamic_Service_Dependency.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Iliyan Jeliazkov <iliyan@ociweb.com>
11 //=============================================================================
13 #ifndef ACE_DYNAMIC_SERVICE_DEPENDENCY_H
14 #define ACE_DYNAMIC_SERVICE_DEPENDENCY_H
16 #include /**/ "ace/pre.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/Dynamic_Service_Base.h"
24 #include "ace/Service_Object.h"
25 #include "ace/DLL.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class ACE_Dynamic_Service_Dependency
32 * @brief Provides a way to declare dependency on specific service,
33 * thus helping to avoid order of initialization issues with instances
34 * of an objects whose implementation code resides in dynamically loaded
35 * services.
37 * It is disastrous to have dynamically loadable services create and give away
38 * ownership of objects and then ending up being unloaded before all those
39 * instances have been deleted. Normally the code for such objects classes
40 * resides within the TEXT segment of the DLL, which implements the service.
41 * If a service gets removed, its DLL may be unmapped from memory and then
42 * any attempt to invoke a method on the said objects will cause SEGV.
44 * Such instances must contain a member of ACE_Dynamic_Service_Dependency
45 * initialized with the service they depend on.
46 * ACE_Dynamic_Service_Dependency's constructor and destructor are
47 * "magical" - they work by maintaining the underlying dynamic service's
48 * DLL reference count.
50 class ACE_Export ACE_Dynamic_Service_Dependency
52 public:
53 ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg,
54 const ACE_TCHAR *principal);
55 ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal);
56 ~ACE_Dynamic_Service_Dependency (void);
58 private:
59 void init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal);
61 private:
62 ACE_DLL tracker_;
65 ACE_END_VERSIONED_NAMESPACE_DECL
68 #include /**/ "ace/post.h"
70 #endif /* ACE_DYNAMIC_SERVICE_DEPENDENCY_H */