summaryrefslogtreecommitdiff
path: root/docs/tutorials/021/mpool.cpp
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-09-23 19:31:01 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-09-23 19:31:01 +0000
commit08d2cf8ae623f5aa87ad12ff30ad4ea9e40c8956 (patch)
tree7cadcc4a888a92984e1d9c9f98ae22367e360838 /docs/tutorials/021/mpool.cpp
parentcaff940a39e93bc503c3a18ef4daf9aa0a85172b (diff)
downloadATCD-pre_avsvc_split.tar.gz
This commit was manufactured by cvs2svn to create tagpre_avsvc_split
'pre_avsvc_split'.
Diffstat (limited to 'docs/tutorials/021/mpool.cpp')
-rw-r--r--docs/tutorials/021/mpool.cpp66
1 files changed, 0 insertions, 66 deletions
diff --git a/docs/tutorials/021/mpool.cpp b/docs/tutorials/021/mpool.cpp
deleted file mode 100644
index 7e55555e5bb..00000000000
--- a/docs/tutorials/021/mpool.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-// $Id$
-
-#include "mpool.h"
-
-#if !defined (ACE_LACKS_SYSV_SHMEM)
-
-/*
- Set the values of all of the constants. This guarantees that client
- and server don't get confused.
- */
-const int Constants::SEM_KEY_1 = ACE_DEFAULT_SEM_KEY + 1;
-const int Constants::SEM_KEY_2 = ACE_DEFAULT_SEM_KEY + 2;
-
-const int Constants::SHMSZ = 27;
-const char * Constants::SHMDATA = "abcdefghijklmnopqrstuvwxyz";
-
-const char * Constants::PoolName = "SharedMemoryPool";
-const char * Constants::RegionName = "Alphabet";
-
-/*
- We have to create a copy of the _name parameter in case the caller
- has dynamically allocated it. The pool_ is set to NULL & will be
- allocated by the accessor.
- */
-Allocator::Allocator (const char *_name)
- : name_ (ACE_OS::strdup (_name)),
- pool_ (0)
-{
- if (name_ == 0)
- ACE_ERROR ((LM_ERROR, "(%P) %p",
- "Allocator::Allocator cannot strdup pool name"));
-}
-
-Allocator::~Allocator (void)
-{
- /*
- strdup() uses malloc(), so we must use free() to clean up.
- */
- if (name_)
- ACE_OS::free (name_);
-
- // delete doesn't really care if you give it a NULL pointer.
- delete pool_;
-}
-
-/*
- Allocate the pool. Since we return a reference, we'll be in really
- bad shape if the new fails. This is a great place to throw an
- exception!
- The other concern is thread safety. If two threads call here at
- about the same time, we may create the pool twice. We can't use a
- Singleton because we want to have multiple Allocator instances. The
- Singleton techniques can be used though.
- */
-
-Allocator::pool_t &
-Allocator::pool (void)
-{
- if (pool_ == 0)
- pool_ = new pool_t (name_);
-
- return *pool_;
-}
-
-#endif /* ACE_LACKS_SYSV_SHMEM */