1 // $Id: MEM_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/MEM_SAP.h"
5 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
7 #if !defined (__ACE_INLINE__)
8 #include "ace/MEM_SAP.inl"
9 #endif /* __ACE_INLINE__ */
11 ACE_RCSID(ace
, MEM_SAP
, "$Id: MEM_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $")
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP
)
18 ACE_MEM_SAP::dump (void) const
20 #if defined (ACE_HAS_DUMP)
21 ACE_TRACE ("ACE_MEM_SAP::dump");
23 ACE_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
24 if (this->shm_malloc_
!= 0)
25 this->shm_malloc_
->dump ();
27 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("ACE_MEM_SAP uninitialized.\n")));
28 ACE_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
29 #endif /* ACE_HAS_DUMP */
32 ACE_MEM_SAP::ACE_MEM_SAP (void)
33 : handle_ (ACE_INVALID_HANDLE
),
36 // ACE_TRACE ("ACE_MEM_SAP::ACE_MEM_SAP");
39 ACE_MEM_SAP::~ACE_MEM_SAP (void)
41 // ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP");
42 delete this->shm_malloc_
;
48 ACE_TRACE ("ACE_MEM_SAP::fini");
50 return this->close_shm_malloc ();
54 ACE_MEM_SAP::create_shm_malloc (const ACE_TCHAR
*name
,
55 MALLOC_OPTIONS
*options
)
57 ACE_TRACE ("ACE_MEM_SAP::create_shm_malloc");
59 if (this->shm_malloc_
!= 0)
60 return -1; // already initialized.
62 ACE_NEW_RETURN (this->shm_malloc_
,
68 if (this->shm_malloc_
->bad () != 0)
70 this->shm_malloc_
->remove (); // Cleanup OS resources
71 delete this->shm_malloc_
;
72 this->shm_malloc_
= 0;
80 ACE_MEM_SAP::close_shm_malloc (void)
82 ACE_TRACE ("ACE_MEM_SAP::close_shm_malloc");
86 if (this->shm_malloc_
!= 0)
87 this->shm_malloc_
->release (1);
89 delete this->shm_malloc_
;
90 this->shm_malloc_
= 0;
95 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
97 ACE_END_VERSIONED_NAMESPACE_DECL