46 pool_ =
new T[count_];
48 items_ =
new T*[count_];
49 for (
long i = 0;
i < count_; ++
i) {
50 items_[
i] = pool_ +
i;
61 long newcnt = 2 * count_;
62 T** itms =
new T*[newcnt];
64 for (
long i = 0;
i < get_; ++
i) {
67 for (
long i = get_,
j = 0;
j < count_; ++
i, ++
j) {
68 itms[
i] =
p->items_[
j];
70 for (
long i = put_,
j = get_;
j < count_; ++
i, ++
j) {
91 if (nget_ >= count_) {
94 T* item = items_[get_];
95 get_ = (get_ + 1) % count_;
98 maxget_ = std::max(nget_, maxget_);
104 template <
typename T>
109 put_ = (put_ + 1) % count_;
114 template <
typename T>
122 for (pp =
this; pp; pp = pp->chain_) {
123 for (
i = 0;
i < pp->pool_size_; ++
i) {
124 items_[put_++] = pp->pool_ +
i;
125 pp->pool_[
i].clear();
MutexPool(long count, int mkmut=0)
#define MUTCONSTRUCT(mkmut)