threadsafequeue.hh

来自「Click is a modular router toolkit. To us」· HH 代码 · 共 76 行

HH
76
字号
// -*- c-basic-offset: 4 -*-#ifndef CLICK_THREADSAFEQUEUE_HH#define CLICK_THREADSAFEQUEUE_HH#include "fullnotequeue.hh"CLICK_DECLS/*=cThreadSafeQueueThreadSafeQueue(CAPACITY)=s storagestores packets in a FIFO queue=dStores incoming packets in a first-in-first-out queue.Drops incoming packets if the queue already holds CAPACITY packets.The default for CAPACITY is 1000.This variant of the default Queue is (should be) completely thread safe, inthat it supports multiple concurrent pushers and pullers.  In all respectsother than thread safety it behaves just like Queue, and like Queue it hasnon-full and non-empty notifiers.=h length read-onlyReturns the current number of packets in the queue.=h highwater_length read-onlyReturns the maximum number of packets that have ever been in the queue at once.=h capacity read/writeReturns or sets the queue's capacity.=h drops read-onlyReturns the number of packets dropped by the queue so far.=h reset_counts write-onlyWhen written, resets the C<drops> and C<highwater_length> counters.=h reset write-onlyWhen written, drops all packets in the queue.=a Queue, SimpleQueue, NotifierQueue, MixedQueue, FrontDropQueue */class ThreadSafeQueue : public FullNoteQueue { public:    ThreadSafeQueue();    ~ThreadSafeQueue();    const char *class_name() const		{ return "ThreadSafeQueue"; }    void *cast(const char *);    int live_reconfigure(Vector<String> &conf, ErrorHandler *errh);    void push(int port, Packet *);    Packet *pull(int port);  private:    atomic_uint32_t _xhead;    atomic_uint32_t _xtail;};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?