Boostヘッダー "pool.hpp" (pool.htmlを見よ)、"detail/singleton.hpp" (singleton.htmlを見よ)、"detail/mutex.hpp" (mutex.htmlを見よ)、"detail/guard.hpp" (guard.htmlを見よ)をインクルードしている。
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: // 公開インタフェースの拡張 typedef Mutex mutex; static const unsigned next_size = NextSize; };
このクラスはmutex型のもので基底であるPoolへの同時アクセスを保護するために使用する。 これは開示されているので、ユーザーはシングルトンプールを通常の様(つまり同期して)に記述することもできるし、効率のために、シングルトンプールを(details::pool::null_mutex を指定して)同期制御無しにすることもできる。
基底となる Pool が生成されるとき、このパラメーターの値が渡される。 より詳しい情報は pool の公開インタフェースの拡張を見よ。
typedef である mutex と静的定数値 next_size はテンプレートパラメータの値 Mutex と NextSize をそれぞれにクラス外に見せる。
Boost multithreading library が完成すれば、Mutex パラメーターは同等の柔軟性を提供する、そのライブラリーの何かで置き換えられ、実装の詳細からインタフェース仕様へ移動されることになるだろう。
Copyright © 2000, 2001 Stephen Cleary (shammah@voyager.net)
This file can be redistributed and/or modified under the terms found in copyright.html
This software and its documentation is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.