/** * Constructor * * \param n the size of the buffer * \param fixedsize a boolean flag that asserts whether the buffer can be * resized. Default is \p false. * \param fillcache a flag. */ uSWSR_Ptr_Buffer(unsigned long n, const bool fixedsize=false, const bool fillcache=false): buf_r(0),buf_w(0),in_use_buffers(1),size(n),fixedsize(fixedsize), pool(CACHE_SIZE,fillcache,size) { init_unlocked(P_lock); init_unlocked(C_lock); #if defined(UBUFFER_STATS) atomic_long_set(&numBuffers,0); #endif // Avoid unused private field warning on padding fields (void)padding1; (void)padding2; (void)padding3; (void)padding4; }
/** * TODO */ dynqueue(int cachesize=DEFAULT_CACHE_SIZE, bool fillcache=false):cache(cachesize) { Node * n = (Node *)::malloc(sizeof(Node)); n->data = NULL; n->next = NULL; head=tail=n; cache.init(); if (fillcache) { for(int i=0;i<cachesize;++i) { n = (Node *)::malloc(sizeof(Node)); if (n) cache.push(n); } } init_unlocked(P_lock); init_unlocked(C_lock); // Avoid unused private field warning on padding vars (void) padding1; (void) padding2 ; (void) padding3; (void) padding4; }