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__ */
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 ACE_ALLOC_HOOK_DEFINE(ACE_MEM_SAP
)
14 ACE_MEM_SAP::dump () const
16 #if defined (ACE_HAS_DUMP)
17 ACE_TRACE ("ACE_MEM_SAP::dump");
19 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
20 if (this->shm_malloc_
!= 0)
21 this->shm_malloc_
->dump ();
23 ACELIB_DEBUG ((LM_DEBUG
, ACE_TEXT ("ACE_MEM_SAP uninitialized.\n")));
24 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
25 #endif /* ACE_HAS_DUMP */
28 ACE_MEM_SAP::ACE_MEM_SAP ()
29 : handle_ (ACE_INVALID_HANDLE
),
32 // ACE_TRACE ("ACE_MEM_SAP::ACE_MEM_SAP");
35 ACE_MEM_SAP::~ACE_MEM_SAP ()
37 // ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP");
38 delete this->shm_malloc_
;
44 ACE_TRACE ("ACE_MEM_SAP::fini");
46 return this->close_shm_malloc ();
50 ACE_MEM_SAP::create_shm_malloc (const ACE_TCHAR
*name
,
51 MALLOC_OPTIONS
*options
)
53 ACE_TRACE ("ACE_MEM_SAP::create_shm_malloc");
55 if (this->shm_malloc_
!= 0)
56 return -1; // already initialized.
58 ACE_NEW_RETURN (this->shm_malloc_
,
64 if (this->shm_malloc_
->bad () != 0)
66 this->shm_malloc_
->remove (); // Cleanup OS resources
67 delete this->shm_malloc_
;
68 this->shm_malloc_
= 0;
76 ACE_MEM_SAP::close_shm_malloc ()
78 ACE_TRACE ("ACE_MEM_SAP::close_shm_malloc");
82 if (this->shm_malloc_
!= 0)
83 if (this->shm_malloc_
->release (1) == 0)
84 ACE_Process_Mutex::unlink (this->shm_malloc_
->memory_pool ().
87 delete this->shm_malloc_
;
88 this->shm_malloc_
= 0;
93 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
95 ACE_END_VERSIONED_NAMESPACE_DECL