File: ACE_Shared_Memory_Pool.3

package info (click to toggle)
ace 5.2.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 26,856 kB
  • ctags: 18,677
  • sloc: cpp: 171,831; makefile: 48,840; sh: 10,192; perl: 8,582; exp: 787; yacc: 387; lex: 140; csh: 20
file content (228 lines) | stat: -rw-r--r-- 8,654 bytes parent folder | download
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
.TH ACE_Shared_Memory_Pool 3 "1 Dec 2001" "ACE" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ACE_Shared_Memory_Pool \- Make a memory pool that is based on System V shared memory (shmget(2) etc.). This implementation allows memory to be shared between processes. If your platform doesn't support System V shared memory (e.g., Win32 and many RTOS platforms do not) then you should use \fBACE_MMAP_Memory_Pool\fR instead of this class. In fact, you should probably use \fBACE_MMAP_Memory_Pool\fR on platforms that *do* support System V shared memory since it provides more powerful features, such as persistent backing store and greatly scalability. 
.SH SYNOPSIS
.br
.PP
\fC#include <Memory_Pool.h>\fR
.PP
Inherits \fBACE_Event_Handler\fR.
.PP
.SS Public Types

.in +1c
.ti -1c
.RI "typedef \fBACE_Shared_Memory_Pool_Options\fR \fBOPTIONS\fR"
.br
.in -1c
.SS Public Methods

.in +1c
.ti -1c
.RI "\fBACE_Shared_Memory_Pool\fR (const \fBACE_TCHAR\fR *backing_store_name = 0, const \fBOPTIONS\fR *options = 0)"
.br
.RI "\fIInitialize the pool.\fR"
.ti -1c
.RI "virtual \fB~ACE_Shared_Memory_Pool\fR (void)"
.br
.ti -1c
.RI "virtual void* \fBinit_acquire\fR (size_t nbytes, size_t &rounded_bytes, int &first_time)"
.br
.RI "\fIAsk system for initial chunk of local memory.\fR"
.ti -1c
.RI "virtual void* \fBacquire\fR (size_t nbytes, size_t &rounded_bytes)"
.br
.ti -1c
.RI "virtual int \fBrelease\fR (void)"
.br
.RI "\fIInstruct the memory pool to release all of its resources.\fR"
.ti -1c
.RI "virtual int \fBsync\fR (\fBssize_t\fR len = -1, int flags = MS_SYNC)"
.br
.RI "\fISync the memory region to the backing store starting at <this->base_addr_>.\fR"
.ti -1c
.RI "virtual int \fBsync\fR (void *addr, size_t len, int flags = MS_SYNC)"
.br
.RI "\fISync the memory region to the backing store starting at .\fR"
.ti -1c
.RI "virtual int \fBprotect\fR (\fBssize_t\fR len = -1, int prot = PROT_RDWR)"
.br
.ti -1c
.RI "virtual int \fBprotect\fR (void *addr, size_t len, int prot = PROT_RDWR)"
.br
.RI "\fIChange the protection of the pages of the mapped region to <prot> starting at  up to <len> bytes.\fR"
.ti -1c
.RI "virtual void \fBdump\fR (void) const"
.br
.RI "\fIDump the state of an object.\fR"
.in -1c
.SS Public Attributes

.in +1c
.ti -1c
.RI "\fBACE_ALLOC_HOOK_DECLARE\fR"
.br
.RI "\fIDeclare the dynamic allocation hooks.\fR"
.in -1c
.SS Protected Methods

.in +1c
.ti -1c
.RI "virtual size_t \fBround_up\fR (size_t nbytes)"
.br
.RI "\fIImplement the algorithm for rounding up the request to an appropriate chunksize.\fR"
.ti -1c
.RI "virtual int \fBcommit_backing_store_name\fR (size_t rounded_bytes, off_t &offset)"
.br
.ti -1c
.RI "virtual int \fBfind_seg\fR (const void *const searchPtr, off_t &offset, size_t &counter)"
.br
.RI "\fIfind the segment that contains the searchPtr.\fR"
.ti -1c
.RI "virtual int \fBin_use\fR (off_t &offset, size_t &counter)"
.br
.RI "\fIDetermine how much memory is currently in use.\fR"
.ti -1c
.RI "virtual int \fBhandle_signal\fR (int signum, \fBsiginfo_t\fR *, \fBucontext_t\fR *)"
.br
.RI "\fIHandle SIGSEGV and SIGBUS signals to remap shared memory properly.\fR"
.in -1c
.SS Protected Attributes

.in +1c
.ti -1c
.RI "void* \fBbase_addr_\fR"
.br
.ti -1c
.RI "size_t \fBfile_perms_\fR"
.br
.RI "\fIFile permissions to use when creating/opening a segment.\fR"
.ti -1c
.RI "size_t \fBmax_segments_\fR"
.br
.RI "\fINumber of shared memory segments in the <\fBSHM_TABLE\fR> table.\fR"
.ti -1c
.RI "off_t \fBminimum_bytes_\fR"
.br
.RI "\fIWhat the minimim bytes of the initial segment should be.\fR"
.ti -1c
.RI "size_t \fBsegment_size_\fR"
.br
.RI "\fIShared memory segment size.\fR"
.ti -1c
.RI "key_t \fBbase_shm_key_\fR"
.br
.RI "\fIBase shared memory key for the segment.\fR"
.ti -1c
.RI "\fBACE_Sig_Handler\fR \fBsignal_handler_\fR"
.br
.RI "\fIHandles SIGSEGV.\fR"
.in -1c
.SH DETAILED DESCRIPTION
.PP 
Make a memory pool that is based on System V shared memory (shmget(2) etc.). This implementation allows memory to be shared between processes. If your platform doesn't support System V shared memory (e.g., Win32 and many RTOS platforms do not) then you should use \fBACE_MMAP_Memory_Pool\fR instead of this class. In fact, you should probably use \fBACE_MMAP_Memory_Pool\fR on platforms that *do* support System V shared memory since it provides more powerful features, such as persistent backing store and greatly scalability.
.PP
.SH MEMBER TYPEDEF DOCUMENTATION
.PP 
.SS typedef \fBACE_Shared_Memory_Pool_Options\fR ACE_Shared_Memory_Pool::OPTIONS
.PP
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP 
.SS ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const \fBACE_TCHAR\fR * backing_store_name = 0, const \fBOPTIONS\fR * options = 0)
.PP
Initialize the pool.
.PP
.SS virtual ACE_Shared_Memory_Pool::~ACE_Shared_Memory_Pool (void)\fC [virtual]\fR
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.PP 
.SS void * ACE_Shared_Memory_Pool::acquire (size_t nbytes, size_t & rounded_bytes)\fC [virtual]\fR
.PP
Acquire at least NBYTES from the memory pool. ROUNDED_BYTES is the actual number of bytes allocated. Also acquires an internal semaphore that ensures proper serialization of Memory_Pool initialization across processes. 
.SS int ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes, off_t & offset)\fC [protected, virtual]\fR
.PP
Commits a new shared memory segment if necessary after an  or a signal. <offset> is set to the new offset into the backing store. 
.SS void ACE_Shared_Memory_Pool::dump (void) const\fC [virtual]\fR
.PP
Dump the state of an object.
.PP
.SS int ACE_Shared_Memory_Pool::find_seg (const void *const searchPtr, off_t & offset, size_t & counter)\fC [protected, virtual]\fR
.PP
find the segment that contains the searchPtr.
.PP
.SS int ACE_Shared_Memory_Pool::handle_signal (int signum, \fBsiginfo_t\fR *, \fBucontext_t\fR *)\fC [protected, virtual]\fR
.PP
Handle SIGSEGV and SIGBUS signals to remap shared memory properly.
.PP
Reimplemented from \fBACE_Event_Handler\fR.
.SS int ACE_Shared_Memory_Pool::in_use (off_t & offset, size_t & counter)\fC [protected, virtual]\fR
.PP
Determine how much memory is currently in use.
.PP
.SS void * ACE_Shared_Memory_Pool::init_acquire (size_t nbytes, size_t & rounded_bytes, int & first_time)\fC [virtual]\fR
.PP
Ask system for initial chunk of local memory.
.PP
.SS int ACE_Shared_Memory_Pool::protect (void * addr, size_t len, int prot = PROT_RDWR)\fC [virtual]\fR
.PP
Change the protection of the pages of the mapped region to <prot> starting at  up to <len> bytes.
.PP
.SS int ACE_Shared_Memory_Pool::protect (\fBssize_t\fR len = -1, int prot = PROT_RDWR)\fC [virtual]\fR
.PP
Change the protection of the pages of the mapped region to <prot> starting at <this->base_addr_> up to <len> bytes. If <len> == -1 then change protection of all pages in the mapped region. 
.SS int ACE_Shared_Memory_Pool::release (void)\fC [virtual]\fR
.PP
Instruct the memory pool to release all of its resources.
.PP
.SS size_t ACE_Shared_Memory_Pool::round_up (size_t nbytes)\fC [protected, virtual]\fR
.PP
Implement the algorithm for rounding up the request to an appropriate chunksize.
.PP
.SS int ACE_Shared_Memory_Pool::sync (void * addr, size_t len, int flags = MS_SYNC)\fC [virtual]\fR
.PP
Sync the memory region to the backing store starting at .
.PP
.SS int ACE_Shared_Memory_Pool::sync (\fBssize_t\fR len = -1, int flags = MS_SYNC)\fC [virtual]\fR
.PP
Sync the memory region to the backing store starting at <this->base_addr_>.
.PP
.SH MEMBER DATA DOCUMENTATION
.PP 
.SS ACE_Shared_Memory_Pool::ACE_ALLOC_HOOK_DECLARE
.PP
Declare the dynamic allocation hooks.
.PP
.SS void * ACE_Shared_Memory_Pool::base_addr_\fC [protected]\fR
.PP
Base address of the shared memory segment. If this has the value of 0 then the OS is free to select any address, otherwise this value is what the OS must try to use to map the shared memory segment. 
.SS key_t ACE_Shared_Memory_Pool::base_shm_key_\fC [protected]\fR
.PP
Base shared memory key for the segment.
.PP
.SS size_t ACE_Shared_Memory_Pool::file_perms_\fC [protected]\fR
.PP
File permissions to use when creating/opening a segment.
.PP
.SS size_t ACE_Shared_Memory_Pool::max_segments_\fC [protected]\fR
.PP
Number of shared memory segments in the <\fBSHM_TABLE\fR> table.
.PP
.SS off_t ACE_Shared_Memory_Pool::minimum_bytes_\fC [protected]\fR
.PP
What the minimim bytes of the initial segment should be.
.PP
.SS size_t ACE_Shared_Memory_Pool::segment_size_\fC [protected]\fR
.PP
Shared memory segment size.
.PP
.SS \fBACE_Sig_Handler\fR ACE_Shared_Memory_Pool::signal_handler_\fC [protected]\fR
.PP
Handles SIGSEGV.
.PP


.SH AUTHOR
.PP 
Generated automatically by Doxygen for ACE from the source code.