2 #include "../acl_cpp_define.hpp" 52 : size_(0), free_obj_(free_obj), cond_(&lock_) {}
63 void clear(
bool free_obj =
false)
66 for (
typename std::list<T*>::iterator it =
67 tbox_.begin(); it != tbox_.end(); ++it) {
82 bool push(T* t,
bool notify_first =
true)
84 if (lock_.
lock() ==
false) {
91 if (cond_.
notify() ==
false) {
94 if (lock_.
unlock() ==
false) {
98 if (lock_.
unlock() ==
false) {
101 if (cond_.
notify() ==
false) {
122 T*
pop(
int wait_ms = -1,
bool* found = NULL)
124 long long n = ((
long long) wait_ms) * 1000;
126 if (lock_.
lock() ==
false) {
130 T* t = peek(found_flag);
132 if (lock_.
unlock() ==
false) {
142 if (!cond_.
wait(n,
true) && wait_ms >= 0) {
143 if (lock_.
unlock() ==
false) {
166 if (lock_.
lock() ==
false) {
173 if (lock_.
unlock() ==
false) {
185 T* peek(
bool& found_flag)
187 typename std::list<T*>::iterator it = tbox_.begin();
188 if (it == tbox_.end()) {
T * pop(int wait_ms=-1, bool *found=NULL)
void clear(bool free_obj=false)
bool wait(long long microseconds=-1, bool locked=false)
bool push(T *t, bool notify_first=true)