18 #ifndef LUNCHBOX_POOL_H
19 #define LUNCHBOX_POOL_H
21 #include <lunchbox/scopedMutex.h>
22 #include <lunchbox/spinLock.h>
23 #include <lunchbox/thread.h>
28 template<
typename T,
bool locked = false >
29 class Pool :
public boost::noncopyable
42 LB_TS_SCOPED( _thread );
46 T* item = _cache.back();
55 LB_TS_SCOPED( _thread );
56 _cache.push_back( item );
63 LB_TS_SCOPED( _thread );
64 while( !_cache.empty( ))
73 std::vector< T* > _cache;
77 #endif // LUNCHBOX_POOL_H
Pool()
Construct a new pool.
A fast lock for uncontended memory access.
An object allocation pool.
virtual ~Pool()
Destruct this pool.
void release(T *item)
Release an item for reuse.
void flush()
Delete all cached items.