diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-26 07:10:55 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-26 07:10:55 +0000 |
commit | 7d6b504baf95b3501d7a4d93df0567a1625d46b2 (patch) | |
tree | fee73c0c7dcfcf480641bf1112fe996857d15fa1 | |
parent | a3bfa67783db9ce691535a1509baef0ae83693af (diff) | |
download | ATCD-7d6b504baf95b3501d7a4d93df0567a1625d46b2.tar.gz |
foobaz
foobar
foo
-rw-r--r-- | examples/Shared_Malloc/Makefile | 3 | ||||
-rw-r--r-- | examples/Shared_Malloc/Malloc.cpp | 48 | ||||
-rw-r--r-- | examples/Shared_Malloc/test_persistence.cpp | 8 |
3 files changed, 20 insertions, 39 deletions
diff --git a/examples/Shared_Malloc/Makefile b/examples/Shared_Malloc/Makefile index 002d0d7f06d..bcc2444175f 100644 --- a/examples/Shared_Malloc/Makefile +++ b/examples/Shared_Malloc/Makefile @@ -9,7 +9,8 @@ #---------------------------------------------------------------------------- BIN = test_malloc \ - test_persistence + test_persistence \ + test_multiple_mallocs FILES = Malloc \ Options diff --git a/examples/Shared_Malloc/Malloc.cpp b/examples/Shared_Malloc/Malloc.cpp index 23bf6fd3833..78759527377 100644 --- a/examples/Shared_Malloc/Malloc.cpp +++ b/examples/Shared_Malloc/Malloc.cpp @@ -10,44 +10,24 @@ typedef ACE_Thread_Mutex THREAD_MUTEX; typedef ACE_Null_Mutex THREAD_MUTEX; #endif /* ACE_HAS_THREADS */ -// ACE_Process_Mutex will work for non-MT platforms. -typedef ACE_Process_Mutex PROCESS_MUTEX; - -class MMAP_POOL : public ACE_MMAP_Memory_Pool - // = TITLE - // This class is an "adapter" that passes certain arguments to the - // constructor of ACE_MMAP_Memory_Pool. -{ -public: - MMAP_POOL (const char *); - - static const char BACKING_STORE[]; -}; - -const char MMAP_POOL::BACKING_STORE[] = "/tmp/test_malloc"; - -MMAP_POOL::MMAP_POOL (const char *) - : ACE_MMAP_Memory_Pool (BACKING_STORE, // Name of the backing store. - 1, // Use fixed addr. - 1) // Write each page of backing store. -{ -} - // Strategic typedefs for memory allocation. -typedef ACE_Malloc <ACE_Local_Memory_Pool, THREAD_MUTEX> L_ALLOCATOR; +typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX> L_ALLOCATOR; +typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> M_ALLOCATOR; + +#if defined (ACE_LACKS_SYSV_SHMEM) +typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, THREAD_MUTEX> SP_ALLOCATOR; +typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, THREAD_MUTEX> ST_ALLOCATOR; +#else +typedef ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex> SP_ALLOCATOR; +typedef ACE_Malloc <ACE_SHARED_MEMORY_POOL, THREAD_MUTEX> ST_ALLOCATOR; +#endif /* ACE_LACKS_SYSV_SHMEM */ -#if !defined (ACE_WIN32) -typedef ACE_Malloc <MMAP_POOL, PROCESS_MUTEX> M_ALLOCATOR; -typedef ACE_Malloc <ACE_Shared_Memory_Pool, PROCESS_MUTEX> SP_ALLOCATOR; -typedef ACE_Malloc <ACE_Shared_Memory_Pool, THREAD_MUTEX> ST_ALLOCATOR; -typedef ACE_Malloc <ACE_Sbrk_Memory_Pool, THREAD_MUTEX> SB_ALLOCATOR; +#if defined (ACE_LACKS_SBRK) +typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX> SB_ALLOCATOR; #else -typedef ACE_Malloc <MMAP_POOL, THREAD_MUTEX> M_ALLOCATOR; -typedef ACE_Malloc <MMAP_POOL, THREAD_MUTEX> SP_ALLOCATOR; -typedef ACE_Malloc <MMAP_POOL, THREAD_MUTEX> ST_ALLOCATOR; -typedef ACE_Malloc <ACE_Local_Memory_Pool, THREAD_MUTEX> SB_ALLOCATOR; -#endif /* ACE_WIN32 */ +typedef ACE_Malloc <ACE_SBRK_MEMORY_POOL, THREAD_MUTEX> SB_ALLOCATOR; +#endif /* ACE_LACKS_SBRK */ // Singleton ACE_Allocator *Malloc::instance_ = 0; diff --git a/examples/Shared_Malloc/test_persistence.cpp b/examples/Shared_Malloc/test_persistence.cpp index dd2e3aefcb2..d534aeefa46 100644 --- a/examples/Shared_Malloc/test_persistence.cpp +++ b/examples/Shared_Malloc/test_persistence.cpp @@ -5,8 +5,8 @@ #include "ace/Log_Msg.h" #include "ace/Malloc.h" -typedef ACE_Malloc <ACE_MMAP_Memory_Pool, ACE_Null_Mutex> MALLOC; -typedef ACE_Malloc_Iterator <ACE_MMAP_Memory_Pool, ACE_Null_Mutex> MALLOC_ITERATOR; +typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC; +typedef ACE_Malloc_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC_ITERATOR; // Shared memory manager. static MALLOC *shmem_manager = 0; @@ -241,6 +241,6 @@ main (int argc, char *argv[]) } #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Malloc <ACE_MMAP_Memory_Pool, ACE_Null_Mutex>; -template class ACE_Malloc_Iterator <ACE_MMAP_Memory_Pool, ACE_Null_Mutex>; +template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>; +template class ACE_Malloc_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ |