MCPcopy Create free account
hub / github.com/apache/brpc / push

Method push

src/bthread/id.cpp:38–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 SmallQueue() : _begin(0), _size(0), _full(NULL) {}
37
38 void push(const T& val) {
39 if (_full != NULL && !_full->empty()) {
40 _full->push_back(val);
41 } else if (_size < N) {
42 int tail = _begin + _size;
43 if (tail >= N) {
44 tail -= N;
45 }
46 _c[tail] = val;
47 ++_size;
48 } else {
49 if (_full == NULL) {
50 _full = new std::deque<T>;
51 }
52 _full->push_back(val);
53 }
54 }
55 bool pop(T* val) {
56 if (_size > 0) {
57 *val = _c[_begin];

Callers 5

id_statusFunction · 0.45
push_priority_queueMethod · 0.45
push_rqMethod · 0.45
take_sampleMethod · 0.45

Calls 2

emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected