diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-14 18:50:53 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-14 18:50:53 +0000 |
commit | 14fd1e7eddebed74c04c94f0e583e6bc63fa9bbf (patch) | |
tree | 880aaa31f2795aa4f716453c2ef495e0f080a70e /examples/Shared_Malloc/Malloc.cpp | |
parent | 308424533b37cc4dc3b7fb7b9b006d206001fe08 (diff) | |
download | ATCD-0_8_3.tar.gz |
This commit was manufactured by cvs2svn to create tag 'v0_8_3'.v0_8_3
Diffstat (limited to 'examples/Shared_Malloc/Malloc.cpp')
-rw-r--r-- | examples/Shared_Malloc/Malloc.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/examples/Shared_Malloc/Malloc.cpp b/examples/Shared_Malloc/Malloc.cpp deleted file mode 100644 index c0ddc352df5..00000000000 --- a/examples/Shared_Malloc/Malloc.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "Options.h" -// $Id$ - -#include "Malloc.h" - -// Determine the type of dynamic memory manager. -#if defined (ACE_HAS_THREADS) -typedef ACE_Thread_Mutex THREAD_MUTEX; -#else -typedef ACE_Null_Mutex THREAD_MUTEX; -#endif /* ACE_HAS_THREADS */ - -// Strategic typedefs for memory allocation. - -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_LACKS_SBRK) -typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX> SB_ALLOCATOR; -#else -typedef ACE_Malloc <ACE_SBRK_MEMORY_POOL, THREAD_MUTEX> SB_ALLOCATOR; -#endif /* ACE_LACKS_SBRK */ - -// Singleton -ACE_Allocator *Malloc::instance_ = 0; - -// This is a factory that decides what type of allocator to create. - -ACE_Allocator * -Malloc::instance (void) -{ - if (Malloc::instance_ == 0) - { - if (Options::instance ()->child ()) - Malloc::instance_ = new ACE_Allocator_Adapter<M_ALLOCATOR>; - else if (Options::instance ()->spawn_threads ()) - { - if (Options::instance ()->use_sbrk ()) - Malloc::instance_ = new ACE_Allocator_Adapter<SB_ALLOCATOR>; - else if (Options::instance ()->use_shmem ()) - Malloc::instance_ = new ACE_Allocator_Adapter<ST_ALLOCATOR>; - else - Malloc::instance_ = new ACE_Allocator_Adapter<L_ALLOCATOR>; - } - else if (Options::instance ()->use_mmap ()) - Malloc::instance_ = new ACE_Allocator_Adapter<M_ALLOCATOR>; - else // Use Shared_Memory_Pool. - Malloc::instance_ = new ACE_Allocator_Adapter<SP_ALLOCATOR>; - } - - return Malloc::instance_; -} - - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Allocator_Adapter<L_ALLOCATOR>; -template class ACE_Allocator_Adapter<M_ALLOCATOR>; -template class ACE_Allocator_Adapter<SB_ALLOCATOR>; -template class ACE_Allocator_Adapter<SP_ALLOCATOR>; -template class ACE_Allocator_Adapter<ST_ALLOCATOR>; -template class ACE_Guard<ACE_Process_Mutex>; -template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX>; -template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex>; -template class ACE_Read_Guard<ACE_Process_Mutex>; -template class ACE_Read_Guard<THREAD_MUTEX>; -template class ACE_Write_Guard<ACE_Process_Mutex>; -template class ACE_Write_Guard<THREAD_MUTEX>; - -#if defined (ACE_LACKS_SYSV_SHMEM) -template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, THREAD_MUTEX>; -#else -template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex>; -template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, THREAD_MUTEX>; -#endif /* ACE_LACKS_SYSV_SHMEM */ - -#if defined (ACE_LACKS_SBRK) -template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX>; -#else -template class ACE_Malloc <ACE_SBRK_MEMORY_POOL, THREAD_MUTEX>; -#endif /* ACE_LACKS_SBRK */ -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ |