blob: 494d53db3d769c8d045dd9e607aa2b7135a07080 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// -*- C++ -*-
#include "ace/RW_Thread_Mutex.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_MEM_SAP_Node::ACE_MEM_SAP_Node (size_t cap)
: capacity_ (cap),
size_ (0),
next_ (0)
{
}
ACE_INLINE size_t
ACE_MEM_SAP_Node::size () const
{
return this->size_;
}
ACE_INLINE size_t
ACE_MEM_SAP_Node::capacity () const
{
return this->capacity_;
}
ACE_INLINE void *
ACE_MEM_SAP_Node::data (void)
{
return this + 1;
}
ACE_INLINE ACE_MEM_SAP_Node *
ACE_MEM_SAP::acquire_buffer (const ssize_t size)
{
ACE_TRACE ("ACE_MEM_SAP::acquire_buffer");
if (this->shm_malloc_ == 0)
return 0; // not initialized.
ACE_MEM_SAP_Node *buf = 0;
ACE_NEW_MALLOC_RETURN (buf,
static_cast<ACE_MEM_SAP_Node *>
(this->shm_malloc_->malloc (sizeof (ACE_MEM_SAP_Node) + size)),
ACE_MEM_SAP_Node (size),
0);
return buf;
}
ACE_INLINE int
ACE_MEM_SAP::release_buffer (ACE_MEM_SAP_Node *buf)
{
ACE_TRACE ("ACE_MEM_SAP::release_buffer");
if (this->shm_malloc_ == 0)
return -1; // not initialized.
this->shm_malloc_->free (buf);
return 0;
}
ACE_END_VERSIONED_NAMESPACE_DECL
|