1 #include "ace/MEM_SAP.h"
3 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
5 #if !defined (__ACE_INLINE__)
6 #include "ace/MEM_SAP.inl"
7 #endif /* __ACE_INLINE__ */
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 ACE_ALLOC_HOOK_DEFINE(ACE_MEM_SAP
)
16 ACE_MEM_SAP::dump (void) const
18 #if defined (ACE_HAS_DUMP)
19 ACE_TRACE ("ACE_MEM_SAP::dump");
21 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
22 if (this->shm_malloc_
!= 0)
23 this->shm_malloc_
->dump ();
25 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("ACE_MEM_SAP uninitialized.\n")));
26 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
27 #endif /* ACE_HAS_DUMP */
30 ACE_MEM_SAP::ACE_MEM_SAP (void)
31 : handle_ (ACE_INVALID_HANDLE
),
34 // ACE_TRACE ("ACE_MEM_SAP::ACE_MEM_SAP");
37 ACE_MEM_SAP::~ACE_MEM_SAP (void)
39 // ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP");
40 delete this->shm_malloc_
;
46 ACE_TRACE ("ACE_MEM_SAP::fini");
48 return this->close_shm_malloc ();
52 ACE_MEM_SAP::create_shm_malloc (const ACE_TCHAR
*name
,
53 MALLOC_OPTIONS
*options
)
55 ACE_TRACE ("ACE_MEM_SAP::create_shm_malloc");
57 if (this->shm_malloc_
!= 0)
58 return -1; // already initialized.
60 ACE_NEW_RETURN (this->shm_malloc_
,
66 if (this->shm_malloc_
->bad () != 0)
68 this->shm_malloc_
->remove (); // Cleanup OS resources
69 delete this->shm_malloc_
;
70 this->shm_malloc_
= 0;
78 ACE_MEM_SAP::close_shm_malloc (void)
80 ACE_TRACE ("ACE_MEM_SAP::close_shm_malloc");
84 if (this->shm_malloc_
!= 0)
85 if (this->shm_malloc_
->release (1) == 0)
86 ACE_Process_Mutex::unlink (this->shm_malloc_
->memory_pool ().
89 delete this->shm_malloc_
;
90 this->shm_malloc_
= 0;
95 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
97 ACE_END_VERSIONED_NAMESPACE_DECL