Singleton Pool Implementation
Dependencies
Includes the Boost headers "pool.hpp" (see pool.html), "detail/singleton.hpp" (see singleton.html), "detail/mutex.hpp" (see mutex.html), and "detail/guard.hpp" (see guard.html).
Synopsis
template <typename Tag,
unsigned RequestedSize,
typename UserAllocator = default_user_allocator_new_delete,
typename Mutex = details::pool::default_mutex,
unsigned NextSize = 32>
class singleton_pool
{
... // public interface
public: // extensions to public interface
typedef Mutex mutex;
static const unsigned next_size = NextSize;
};
Extensions to Public Interface
Additional template parameters
Mutex
This class is the type of mutex to use to protect simultaneous access to the underlying Pool. It is exposed so that users may declare some singleton pools normally (i.e., with synchronization), but some singleton pools without synchronization (by specifying details::pool::null_mutex) for efficiency reasons.
NextSize
The value of this parameter is passed to the underlying Pool when it is created. See the extensions to the public interface of pool for more information.
Additional members
The typedef mutex and the static const value next_size publish the values of the template parameters Mutex and NextSize, respectively.
Future Directions
When the Boost multithreading library is completed, the Mutex parameter will be replaced by something from that library providing the same flexibility and will move from an implementation detail into the interface specification.
Interface Description
Revised 05 December, 2006
Copyright © 2000, 2001 Stephen Cleary (scleary AT jerviswebb DOT com)
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
