Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > ef9bad9e14fc2a68cb7c992c11d75f5e > files > 3169

libboost1-devel-1.31.0-1mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<HTML>
<HEAD>
<TITLE>Singleton Pool Implementation</TITLE>
<LINK HREF="../pool.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY>

<IMG SRC="../../../../c++boost.gif" WIDTH=276 HEIGHT=86 ALT="C++ Boost">

<H1 ALIGN=CENTER>Singleton Pool Implementation</H1>

<P>
<H2>Dependencies</H2>

<P>
Includes the Boost headers <SPAN CLASS="code">&quot;pool.hpp&quot;</SPAN> (see <A HREF="pool.html">pool.html</A>), <SPAN CLASS="code">&quot;detail/singleton.hpp&quot;</SPAN> (see <A HREF="singleton.html">singleton.html</A>), <SPAN CLASS="code">&quot;detail/mutex.hpp&quot;</SPAN> (see <A HREF="mutex.html">mutex.html</A>), and <SPAN CLASS="code">&quot;detail/guard.hpp&quot;</SPAN> (see <A HREF="guard.html">guard.html</A>).

<P>
<H2>Synopsis</H2>

<PRE CLASS="code">template &lt;typename Tag,
    unsigned RequestedSize,
    typename UserAllocator = default_user_allocator_new_delete,
    typename Mutex = details::pool::default_mutex,
    unsigned NextSize = 32&gt;
class singleton_pool
{
  ... // public interface

  public: // extensions to public interface
    typedef Mutex mutex;
    static const unsigned next_size = NextSize;
};</PRE>

<P>
<H2>Extensions to Public Interface</H2>

<P>
<H3>Additional template parameters</H3>

<P>
<H4 CLASS="code">Mutex</H4>

<P>
This class is the type of <A HREF="mutex.html">mutex</A> 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 <SPAN CLASS="code">details::pool::null_mutex</SPAN>) for efficiency reasons.

<P>
<H4 CLASS="code">NextSize</H4>

<P>
The value of this parameter is passed to the underlying Pool when it is created.  See the extensions to the public interface of <A HREF="pool.html">pool</A> for more information.

<P>
<H3>Additional members</H3>

<P>
The typedef <SPAN CLASS="code">mutex</SPAN> and the static const value <SPAN CLASS="code">next_size</SPAN> publish the values of the template parameters <SPAN CLASS="code">Mutex</SPAN> and <SPAN CLASS="code">NextSize</SPAN>, respectively.

<P>
<H2>Future Directions</H2>

<P>
When the Boost multithreading library is completed, the <SPAN CLASS="code">Mutex</SPAN> parameter will be replaced by something from that library providing the same flexibility and will move from an implementation detail into the interface specification.

<P>
<H2><A HREF="../interfaces/singleton_pool.html">Interface Description</A></H2>

<P>
<HR>

<P>
Copyright &copy; 2000, 2001 Stephen Cleary (scleary AT jerviswebb DOT com)

<P>
This file can be redistributed and/or modified under the terms found in <A HREF="../copyright.html">copyright.html</A>

<P>
This software and its documentation is provided &quot;as is&quot; without express or implied warranty, and with no claim as to its suitability for any purpose.

</BODY>
</HTML>