5 #ifndef CVMFS_UTIL_TUBE_H_
6 #define CVMFS_UTIL_TUBE_H_
38 template <
class ItemT>
60 Link *prev = cursor->
prev_;
63 }
while (cursor !=
head_);
67 pthread_mutex_destroy(&
lock_);
79 Link *link =
new Link(item);
99 Link *link =
new Link(item);
177 Link *sentinel =
new Link(NULL);
181 int retval = pthread_mutex_init(&
lock_, NULL);
194 link->prev_->next_ = link->next_;
195 link->next_->prev_ = link->prev_;
196 ItemT *item = link->item_;
245 template <
class ItemT>
253 for (
unsigned i = 0; i <
tubes_.size(); ++i)
273 unsigned tube_idx = (
tubes_.size() == 1)
274 ? 0 : (item->tag() %
tubes_.size());
275 return tubes_[tube_idx]->EnqueueBack(item);
283 unsigned tube_idx = (
tubes_.size() == 1)
285 return tubes_[tube_idx]->EnqueueBack(item);
294 #endif // CVMFS_UTIL_TUBE_H_
Tube< ItemT >::Link * DispatchAny(ItemT *item)
ItemT * Slice(Link *link)
assert((mem||(size==0))&&"Out Of Memory")
pthread_cond_t cond_empty_
atomic_int32 round_robin_
pthread_cond_t cond_populated_
ItemT * SliceUnlocked(Link *link)
Link * EnqueueFront(ItemT *item)
Link * EnqueueBack(ItemT *item)
Tube< ItemT >::Link * Dispatch(ItemT *item)
void TakeTube(Tube< ItemT > *t)
pthread_cond_t cond_capacious_
std::vector< Tube< ItemT > * > tubes_