1 kumpf 1.27 //%/////////////////////////////////////////////////////////////////////////////
|
2 mday 1.1 //
|
3 kumpf 1.27 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 mday 1.1 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 kumpf 1.27 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 mday 1.1 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
|
13 kumpf 1.27 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mday 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 kumpf 1.27 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 mday 1.1 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
|
22 kumpf 1.27 //==============================================================================
|
23 mday 1.1 //
24 // Author: Mike Day (mdday@us.ibm.com)
25 //
26 // Modified By:
|
27 david.eger 1.32 // David Eger (dteger@us.ibm.com)
|
28 mday 1.1 //
29 //%/////////////////////////////////////////////////////////////////////////////
30
31 #ifndef PEGASUS_SUBALLOC_INCLUDE
32 #define PEGASUS_SUBALLOC_INCLUDE 1
|
33 mday 1.2
|
34 mday 1.1 #include <Pegasus/Common/Config.h>
|
35 kumpf 1.15 #include <Pegasus/suballoc/Linkage.h>
|
36 mday 1.28 #include <stdio.h>
|
37 mday 1.1 #if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
38 #include <windows.h>
39 #include <process.h>
|
40 mday 1.3 #include <stdio.h>
|
41 mday 1.24 #include <malloc.h>
42 #include <stdlib.h>
43
|
44 david.eger 1.33 #elif defined (PEGASUS_PLATFORM_LINUX_GENERIC_GNU)
45 #include <sched.h>
46 #include <semaphore.h>
|
47 mday 1.1 #include <pthread.h>
48 #include <unistd.h>
|
49 chuck 1.29 #include <malloc.h>
|
50 mday 1.1
51 #elif defined (PEGASUS_PLATFORM_AIX_RS_IBMCXX)
52 #include <sched.h>
53 #include <pthread.h>
54 #include <semaphore.h>
55 #include <unistd.h>
|
56 chuck 1.29 #include <malloc.h>
|
57 mday 1.1
|
58 kumpf 1.31 #elif defined (PEGASUS_PLATFORM_HPUX_ACC)
|
59 mday 1.1 #include <sched.h>
60 #include <semaphore.h>
61 #include <pthread.h>
62 #include <unistd.h>
|
63 chuck 1.29 #include <malloc.h>
|
64 mday 1.1
65 #elif defined (PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX)
66 #include <sched.h>
67 #include <semaphore.h>
68 #include <pthread.h>
69 #include <unistd.h>
|
70 chuck 1.29 #include <malloc.h>
|
71 mday 1.1
72 #elif defined (PEGASUS_PLATFORM_SOLARIS_SPARC_GNU)
73 #include <sched.h>
74 #include <semaphore.h>
75 #include <pthread.h>
76 #include <unistd.h>
|
77 chuck 1.29 #include <malloc.h>
|
78 mday 1.1
79 #elif defined (PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
80 #include <sched.h>
81 #include <semaphore.h>
82 #include <pthread.h>
83 #include <unistd.h>
|
84 chuck 1.29 #include <malloc.h>
|
85 mday 1.1
|
86 chuck 1.29 #elif defined (PEGASUS_PLATFORM_OS400_ISERIES_IBM)
87 #include <sched.h>
88 #include <semaphore.h>
89 #include <pthread.h>
90 #include <unistd.cleinc>
91 #include <stdlib.h>
|
92 mday 1.2
|
93 mday 1.1 #else
94 # error "<Pegasus/Common/Config.h>: Unsupported Platform"
95 #endif
96
97 #include <time.h>
98 #include <assert.h>
99 #include <stdio.h>
100 #include <string.h>
101 #include <memory.h>
102 #include <errno.h>
103 #include <signal.h>
|
104 mday 1.24 #include <new.h>
|
105 mday 1.8 namespace
106 {
107 static const int GUARD_SIZE = 0x10;
108 static const int MAX_PATH_LEN = 0xff;
109 static const int MAX_LINE_LEN = 0x14;
|
110 mday 1.13 static const int MAX_CLASS_LEN = 0x40;
|
111 mday 1.8 static const int PRE_ALLOCATE = 0x00;
112 static const int STEP_ALLOCATE = 0x01;
113 static const int AVAILABLE = 0x00;
|
114 mday 1.18 static const int NORMAL = 0x00;
115 static const int ARRAY = 0x01;
|
116 mday 1.21 static const unsigned int IS_HEAD_NODE = 0x00000001;
117 static const unsigned int AVAIL = 0x00000002;
118 static const unsigned int ARRAY_NODE = 0x00000004;
119 static const unsigned int CHECK_FAILED = 0x00000008;
120 static const unsigned int ALREADY_DELETED = 0x00000010;
121 static const unsigned int OVERWRITE = 0x00000020;
122 static const unsigned int CHECK_LEAK = 0x00000040;
|
123 mday 1.23 static const unsigned int HUGE_NODE = 0x00000080;
|
124 mday 1.8 }
125
|
126 mday 1.1 PEGASUS_NAMESPACE_BEGIN
127
|
128 mday 1.19 struct SUBALLOC_HANDLE;
|
129 mday 1.14
|
130 mday 1.23 #if defined(PEGASUS_DEBUG_MEMORY)
|
131 mday 1.19 PEGASUS_SUBALLOC_LINKAGE void * pegasus_alloc(size_t,
132 void *,
133 int type,
|
134 mday 1.18 const Sint8 *classname,
135 Sint8 *file,
|
136 mday 1.19 Uint32 line );
|
137 mday 1.23
|
138 mday 1.18 PEGASUS_SUBALLOC_LINKAGE void pegasus_free(void *dead,
|
139 mday 1.19 void *,
|
140 mday 1.18 int type,
141 Sint8 *classname,
142 Sint8 *file,
|
143 mday 1.19 Uint32 line);
|
144 mday 1.23 #else
145 PEGASUS_SUBALLOC_LINKAGE void * pegasus_alloc(size_t);
146 PEGASUS_SUBALLOC_LINKAGE void pegasus_free(void *);
147 #endif
148
149
|
150 mday 1.17
|
151 mday 1.21
|
152 mday 1.7
|
153 mday 1.2 #if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
154
155 #define ENOTSOCK WSAENOTSOCK
156 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
157 #define EAFNOSUPPORT WSAEAFNOSUPPORT
158 #define EISCONN WSAEISCONN
159 #define ETIMEDOUT WSAETIMEDOUT
160 #define ECONNREFUSED WSAECONNREFUSED
161 #define ENETUNREACH WSAENETUNREACH
162 #define EADDRINUSE WSAEADDRINUSE
163 #define EINPROGRESS WSAEINPROGRESS
164 #define EALREADY WSAEALREADY
165 #define EWOULDBLOCK WSAEWOULDBLOCK
166 #ifndef EINVAL
167 #define EINVAL WSAEINVAL
168 #endif
|
169 mday 1.3 #define snprintf _snprintf
|
170 mday 1.2 typedef HANDLE PEGASUS_MUTEX_T;
171
|
172 david.eger 1.33 #elif defined (PEGASUS_PLATFORM_LINUX_GENERIC_GNU)
|
173 mday 1.2
174 typedef pthread_mutex_t PEGASUS_MUTEX_T;
175
176 #elif defined (PEGASUS_PLATFORM_AIX_RS_IBMCXX)
177
178 typedef pthread_mutex_t PEGASUS_MUTEX_T;
179
|
180 kumpf 1.31 #elif defined (PEGASUS_PLATFORM_HPUX_ACC)
|
181 mday 1.1
|
182 mday 1.2 typedef pthread_mutex_t PEGASUS_MUTEX_T;
|
183 mday 1.1
|
184 mday 1.2 #elif defined (PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX)
|
185 mday 1.1
|
186 mday 1.2 typedef pthread_mutex_t PEGASUS_MUTEX_T;
|
187 mday 1.1
|
188 mday 1.2 #elif defined (PEGASUS_PLATFORM_SOLARIS_SPARC_GNU)
189
190 typedef pthread_mutex_t PEGASUS_MUTEX_T;
191
192 #elif defined (PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
193
194 typedef pthread_mutex_t PEGASUS_MUTEX_T;
195
196 #elif defined (PEGASUS_PLATFORM_NSK_NONSTOP_NMCPLUS)
197
198 typedef Uint32 PEGASUS_MUTEX_T;
199
|
200 chuck 1.29 #elif defined (PEGASUS_PLATFORM_OS400_ISERIES_IBM)
201
202 typedef pthread_mutex_t PEGASUS_MUTEX_T;
203
|
204 mday 1.1 #endif
205
|
206 mday 1.5 // to reduce the number of wasted bytes:
207 // reduce GUARD_SIZE
208 // eliminate guard checking from SUBALLOC_NODEs
209 //
210
|
211 mday 1.14 class peg_suballoc;
212
|
213 mday 1.17 #if defined(PEGASUS_DEBUG_MEMORY)
|
214 mday 1.21 #define PEGASUS_NEW(a, h) new((pegasus_alloc(sizeof(a), ((void *)h), NORMAL, (#a), __FILE__, __LINE__)))
|
215 mday 1.26 #define PEGASUS_ARRAY_NEW(a, i, h) new(pegasus_alloc(sizeof(a) * (i), ((void *)(h)), ARRAY, (#a), __FILE__, __LINE__)) a
|
216 mday 1.19 #define PEGASUS_DELETE(a) pegasus_free((a), NULL, NORMAL, (#a), __FILE__, __LINE__)
217 #define PEGASUS_ARRAY_DELETE(a) pegasus_free(a, NULL, ARRAY, (#a), __FILE__, __LINE__)
|
218 mday 1.21 #define PEGASUS_CHECK_FOR_LEAKS(h) peg_suballocator::get_instance()->_UnfreedNodes((h))
219 #define PEGASUS_START_LEAK_CHECK() peg_suballocator::get_instance()->set_leak_mode(true)
220 #define PEGASUS_STOP_LEAK_CHECK() peg_suballocator::get_instance()->set_leak_mode(false)
|
221 mday 1.28 #define PEGASUS_PRINT_NODE(a, b) peg_suballocator::PrintNodeInfo((void *)(a), (Sint8 *)(b), __FILE__, __LINE__)
|
222 mday 1.18 #else
|
223 mday 1.21 #define PEGASUS_NEW(a, h) new
|
224 kumpf 1.25 #define PEGASUS_ARRAY_NEW(a, i, h) new a[(i)]
|
225 mday 1.21 #define PEGASUS_DELETE(a) delete((a))
226 #define PEGASUS_ARRAY_DELETE(a) delete [] ((a))
227 #define PEGASUS_CHECK_FOR_LEAKS(h)
228 #define PEGASUS_START_LEAK_CHECK()
229 #define PEGASUS_STOP_LEAK_CHECK()
|
230 mday 1.28 #define PEGASUS_PRINT_NODE(a, b)
|
231 mday 1.17 #endif
232
|
233 mday 1.14
|
234 mday 1.3 class PEGASUS_SUBALLOC_LINKAGE peg_suballocator
|
235 mday 1.2 {
236 private:
237 peg_suballocator(const peg_suballocator &);
238 peg_suballocator & operator = (const peg_suballocator &);
239 Boolean _debug;
240 typedef struct _subAllocNode {
241 struct _subAllocNode *next;
242 struct _subAllocNode *prev;
|
243 mday 1.18 Uint32 flags;
|
244 mday 1.2 Uint32 allocSize;
|
245 mday 1.23 Uint32 nodeSize;
246 void *concurrencyHandle;
247 #if defined(PEGASUS_DEBUG_MEMORY)
|
248 mday 1.2 Sint8 file[MAX_PATH_LEN + 1];
|
249 mday 1.26 Uint32 line;
|
250 mday 1.13 Sint8 classname[MAX_CLASS_LEN + 1];
|
251 mday 1.19 Sint8 d_file[MAX_PATH_LEN + 1];
|
252 mday 1.26 Uint32 d_line;
|
253 mday 1.19 Sint8 d_classname[MAX_CLASS_LEN + 1];
254 Uint8 guardPre[GUARD_SIZE];
|
255 mday 1.23 #endif
|
256 mday 1.2 } SUBALLOC_NODE;
257
258 SUBALLOC_NODE *nodeListHeads[3][16];
259
260 PEGASUS_MUTEX_T globalSemHandle;
261 PEGASUS_MUTEX_T semHandles[3][16];
|
262 mday 1.3 static const Sint32 nodeSizes[3][16];
263 Uint32 allocs[3][16];
264 Uint32 wastedBytes[3][16];
265 Uint32 inUse[3][16];
266 Uint32 avail[3][16] ;
|
267 mday 1.2 Uint32 totalAllocs;
268 Uint32 totalMemoryInUse;
269
|
270 mday 1.5 static const Uint32 preAlloc[3][16];
271 static const Uint32 step[3][16];
|
272 mday 1.2
273 Sint32 initialized;
274 Sint32 init_count;
275 PEGASUS_MUTEX_T init_mutex;
|
276 mday 1.5 Boolean debug_mode;
|
277 mday 1.19 Boolean abort_on_error;
|
278 mday 1.21 Boolean check_for_leaks;
|
279 mday 1.19
|
280 mday 1.14 public:
281 static int CREATE_MUTEX(PEGASUS_MUTEX_T *mut);
282 static void WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result);
283 static void WAIT_MUTEX(PEGASUS_MUTEX_T *mut);
284 static void RELEASE_MUTEX(PEGASUS_MUTEX_T *mut);
285 static void CLOSE_MUTEX(PEGASUS_MUTEX_T *mut);
286 private:
|
287 mday 1.18 static Boolean IS_ARRAY(SUBALLOC_NODE *x);
288 static Boolean IS_HEAD(SUBALLOC_NODE *x);
289 static void INSERT(SUBALLOC_NODE *new_node, SUBALLOC_NODE *after);
290 static void INSERT_AFTER(SUBALLOC_NODE *new_node, SUBALLOC_NODE *after);
291 static void INSERT_BEFORE(SUBALLOC_NODE *new_node, SUBALLOC_NODE *before);
292 static void _DELETE(SUBALLOC_NODE *x);
293 static Boolean IS_LAST(SUBALLOC_NODE *head, SUBALLOC_NODE *node);
294 static Boolean IS_FIRST(SUBALLOC_NODE *head, SUBALLOC_NODE *node);
295 static Boolean IS_ONLY(SUBALLOC_NODE *head, SUBALLOC_NODE *node);
296 static Boolean IS_EMPTY(SUBALLOC_NODE *h) ;
|
297 mday 1.2
298 Boolean _Allocate(Sint32, Sint32, Sint32);
299 void _DeAllocate(Sint32 vector, Sint32 index);
300 SUBALLOC_NODE *GetNode(Sint32 vector, Sint32 index);
301 SUBALLOC_NODE *GetHugeNode(Sint32 size);
302 void PutNode(Sint32 vector, Sint32 index, SUBALLOC_NODE *node);
303 void PutHugeNode(SUBALLOC_NODE *node);
|
304 mday 1.23 #if defined(PEGASUS_DEBUG_MEMORY)
|
305 mday 1.2 static const Uint8 guard[];
|
306 mday 1.5 static const Uint8 alloc_pattern;
307 static const Uint8 delete_pattern;
308
|
309 mday 1.2 static Boolean _CheckGuard(SUBALLOC_NODE *);
|
310 mday 1.24
|
311 mday 1.21
312 static Uint32 _CheckNode(void *m);
313 SUBALLOC_NODE *_CheckNode(void *m, int type, Sint8 *file, Uint32 line);
|
314 mday 1.24 public:
315 static Uint32 CheckMemory(void *);
|
316 mday 1.28 static void PrintNodeInfo(void *, Sint8 *, Sint8 *, Uint32);
317
|
318 mday 1.23 #endif
|
319 mday 1.2 public:
320
|
321 mday 1.7 peg_suballocator(void);
|
322 mday 1.20 peg_suballocator(Boolean mode );
|
323 mday 1.2 virtual ~peg_suballocator(void);
324
325 inline Boolean PEGASUS_DEBUG_ALLOC(void) { return _debug; }
326
|
327 mday 1.14 typedef class PEGASUS_SUBALLOC_LINKAGE _suballocHandle
|
328 mday 1.2 {
329 public:
330 Sint8 logpath[MAX_PATH_LEN + 1];
|
331 mday 1.19 Sint8 classname[MAX_CLASS_LEN + 1];
|
332 kumpf 1.16 _suballocHandle(const Sint8 *log_path = 0)
|
333 mday 1.2 {
334 if(log_path)
335 snprintf(logpath, MAX_PATH_LEN, "%s", log_path);
336 else
337 snprintf(logpath, MAX_PATH_LEN, "%p_suballoc_log", this);
338 }
339 virtual ~_suballocHandle(void)
340 {
341 }
342
343 }SUBALLOC_HANDLE;
344
|
345 mday 1.19 Boolean InitializeSubAllocator(void);
|
346 mday 1.14 static SUBALLOC_HANDLE *InitializeProcessHeap(Sint8 *f = NULL);
|
347 mday 1.23 #if defined(PEGASUS_DEBUG_MEMORY)
|
348 mday 1.19 void *vs_malloc(size_t size, void *handle, int type = NORMAL, const Sint8 *classname = 0, const Sint8 *f = 0, Uint32 l = 0);
349 void *vs_calloc(size_t num, size_t size, void *handle, int type = NORMAL, Sint8 *f = 0, Uint32 l = 0);
350 void *vs_realloc(void *pblock, size_t newsize, void *handle, int type = NORMAL, Sint8 *f = 0, Uint32 l = 0);
351 Sint8 * vs_strdup(const Sint8 *string, void *handle, int type = NORMAL, Sint8 *f = 0, Uint32 l = 0);
352 void vs_free(void *m, void *handle, int type, Sint8 *classname, Sint8 *f, Uint32 l);
|
353 mday 1.2 Boolean _UnfreedNodes(void *handle);
|
354 mday 1.23 Boolean get_mode(void) { return debug_mode; }
355 void set_leak_mode(Boolean mode) { check_for_leaks = mode; }
356 #else
357 void *vs_malloc(size_t size);
358 void *vs_calloc(size_t num, size_t size);
359 void *vs_realloc(void *pblock, size_t newsize);
360 Sint8 *vs_strdup(const Sint8 *str);
361 void vs_free(void *m);
362 Boolean get_mode(void) { return false; }
363 void set_leak_mode(Boolean mode) { }
364 #endif
|
365 mday 1.2 void DeInitSubAllocator(void *handle);
|
366 mday 1.21 static peg_suballocator *get_instance(void);
|
367 mday 1.23 SUBALLOC_HANDLE & get_handle(void) { return internal_handle; }
|
368 mday 1.2 private:
369 _suballocHandle internal_handle;
|
370 mday 1.21 static peg_suballocator *_suballoc_instance;
371
|
372 mday 1.2 };
373
|
374 mday 1.18 inline Boolean peg_suballocator::IS_ARRAY(SUBALLOC_NODE *x)
375 {
|
376 mday 1.19 return (x->flags & ARRAY_NODE) ? true : false ;
|
377 mday 1.18 }
|
378 mday 1.2
|
379 mday 1.18 inline Boolean peg_suballocator::IS_HEAD(SUBALLOC_NODE *x)
380 {
381 return (x->flags & IS_HEAD_NODE) ? true : false ;
382 }
|
383 mday 1.2
384 inline Boolean peg_suballocator::IS_EMPTY(SUBALLOC_NODE *h)
385 {
386 return (( (h)->next == (h) && (h)->prev == (h) ) ? true : false);
387 }
388
389 inline void peg_suballocator::INSERT(SUBALLOC_NODE *new_node, SUBALLOC_NODE *after)
390 {
391 new_node->prev = after;
392 new_node->next = after->next;
393 after->next->prev = new_node;
394 after->next = new_node;
395 }
396
397 inline void peg_suballocator::INSERT_AFTER(SUBALLOC_NODE *new_node, SUBALLOC_NODE *after)
398 {
399 INSERT(new_node, after);
400 return;
401 }
402
403 inline void peg_suballocator::INSERT_BEFORE(SUBALLOC_NODE *new_node, SUBALLOC_NODE *before)
404 mday 1.2 {
405 new_node->next = before;
406 new_node->prev = before->prev;
407 before->prev->next = new_node;
408 before->prev = new_node;
409 }
410
411 inline void peg_suballocator::_DELETE(SUBALLOC_NODE *x)
412 {
413 x->prev->next = x->next;
414 x->next->prev = x->prev;
415 }
416
417 inline Boolean peg_suballocator::IS_LAST(SUBALLOC_NODE *head, SUBALLOC_NODE *node)
418 {
419 return ((node->prev == head && head->prev == node) ? true : false);
420 }
421
422 inline Boolean peg_suballocator::IS_FIRST(SUBALLOC_NODE *head, SUBALLOC_NODE *node)
423 {
424 return ((node->prev == head && head->next == node) ? true : false);
425 mday 1.2 }
426
427 inline Boolean peg_suballocator::IS_ONLY(SUBALLOC_NODE *head, SUBALLOC_NODE *node)
428 {
429 return ((node->next == head && node->prev == head) ? true : false);
430 }
431
432
433
434
435 #if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
436
437 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
438 {
|
439 mday 1.4 if((*mut = ::CreateMutex(NULL, false, NULL))) return 0;
|
440 mday 1.2 return -1;
441 }
442
443 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
444 {
445 assert(mut && *mut && result);
446 *result = WaitForSingleObject(*mut, INFINITE);
447 return;
448 }
449
450 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
451 {
452 WaitForSingleObject(*mut, INFINITE);
453 return;
454 }
455
456 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
457 {
|
458 mday 1.4 ::ReleaseMutex(*mut);
|
459 mday 1.2 return;
460 }
461
462 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
463 {
464 CloseHandle(*mut);
465 *mut = 0;
466 return;
467 }
468
469
|
470 david.eger 1.33 #elif defined (PEGASUS_PLATFORM_LINUX_GENERIC_GNU)
|
471 mday 1.2
472 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
473 {
474 return(pthread_mutex_init(mut, NULL));
475 }
476
477 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
478 {
479 *result = pthread_mutex_lock(mut);
480 return;
481 }
482
483 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
484 {
485 pthread_mutex_lock(mut);
486 }
487
488 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
489 {
490 pthread_mutex_unlock(mut);
491 return;
492 mday 1.2 }
493
494 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
495 {
496 pthread_mutex_destroy(mut);
497 return;
498 }
499
500 #elif defined (PEGASUS_PLATFORM_AIX_RS_IBMCXX)
501
502
503 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
504 {
505 return(pthread_mutex_init(mut, NULL));
506 }
507
508 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
509 {
510 *result = pthread_mutex_lock(mut);
511 return;
512 }
513 mday 1.2
514 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
515 {
516 pthread_mutex_lock(mut);
517 }
518
519 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
520 {
521 pthread_mutex_unlock(mut);
522 return;
523 }
524
525 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
526 {
527 pthread_mutex_destroy(mut);
528 return;
529 }
530
|
531 kumpf 1.31 #elif defined (PEGASUS_PLATFORM_HPUX_ACC)
|
532 mday 1.2
533 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
534 {
535 return(pthread_mutex_init(mut, NULL));
536 }
537
538 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
539 {
540 *result = pthread_mutex_lock(mut);
541 return;
542 }
543
544 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
545 {
546 pthread_mutex_lock(mut);
547 }
548
549 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
550 {
551 pthread_mutex_unlock(mut);
552 return;
553 mday 1.2 }
554
555 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
556 {
557 pthread_mutex_destroy(mut);
558 return;
559 }
560
561 #elif defined (PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX)
562
563 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
564 {
565 return(pthread_mutex_init(mut, NULL));
566 }
567
568 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
569 {
570 *result = pthread_mutex_lock(mut);
571 return;
572 }
573
574 mday 1.2 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
575 {
576 pthread_mutex_lock(mut);
577 }
578
579 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
580 {
581 pthread_mutex_unlock(mut);
582 return;
583 }
584
585 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
586 {
587 pthread_mutex_destroy(mut);
588 return;
589 }
590
591 #elif defined (PEGASUS_PLATFORM_SOLARIS_SPARC_GNU)
592
593 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
594 {
595 mday 1.2 return(pthread_mutex_init(mut, NULL));
596 }
597
598 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
599 {
600 *result = pthread_mutex_lock(mut);
601 return;
602 }
603
604 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
605 {
606 pthread_mutex_lock(mut);
607 }
608
609 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
610 {
611 pthread_mutex_unlock(mut);
612 return;
613 }
614
615 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
616 mday 1.2 {
617 pthread_mutex_destroy(mut);
618 return;
619 }
620
621 #elif defined (PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
|
622 chuck 1.29
623 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
624 {
625 return(pthread_mutex_init(mut, NULL));
626 }
627
628 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
629 {
630 *result = pthread_mutex_lock(mut);
631 return;
632 }
633
634 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
635 {
636 pthread_mutex_lock(mut);
637 }
638
639 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
640 {
641 pthread_mutex_unlock(mut);
642 return;
643 chuck 1.29 }
644
645 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
646 {
647 pthread_mutex_destroy(mut);
648 return;
649 }
650
|
651 kumpf 1.30 #elif defined (PEGASUS_PLATFORM_OS400_ISERIES_IBM)
|
652 mday 1.2
653 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
654 {
655 return(pthread_mutex_init(mut, NULL));
656 }
657
658 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
659 {
660 *result = pthread_mutex_lock(mut);
661 return;
662 }
663
664 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
665 {
666 pthread_mutex_lock(mut);
667 }
668
669 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
670 {
671 pthread_mutex_unlock(mut);
672 return;
673 mday 1.2 }
674
675 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
676 {
677 pthread_mutex_destroy(mut);
678 return;
679 }
680
681 #elif defined (PEGASUS_PLATFORM_NSK_NONSTOP_NMCPLUS)
682
683 inline int peg_suballocator::CREATE_MUTEX(PEGASUS_MUTEX_T *mut)
684 {
685 return(0);
686 }
687
688 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut, Uint32 msec, int *result)
689 {
690 }
691
692 inline void peg_suballocator::WAIT_MUTEX(PEGASUS_MUTEX_T *mut)
693 {
694 mday 1.2
695 }
696
697 inline void peg_suballocator::RELEASE_MUTEX(PEGASUS_MUTEX_T *mut)
698 {
699
700 }
701
702 inline void peg_suballocator::CLOSE_MUTEX(PEGASUS_MUTEX_T *mut)
703 {
704
705 }
|
706 mday 1.1
707 #endif
708
|
709 mday 1.2 PEGASUS_NAMESPACE_END
|
710 mday 1.1
|
711 mday 1.2 #endif /* SUBALLOC_INCLUDE */
|
712 mday 1.1
713
|