MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / recycle_func

Method recycle_func

core/cube/cube-server/src/recycle.cpp:89–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87void Recycle::unlock() { pthread_mutex_unlock(&_recycle_mutex); }
88
89void* Recycle::recycle_func(void* arg) {
90 Recycle* recycle = reinterpret_cast<Recycle*>(arg);
91 std::queue<VirtualDict*>& recycle_list = recycle->_recycle_list;
92
93 while (recycle->_running) {
94 recycle->lock();
95 if (recycle_list.empty()) {
96 recycle->unlock();
97 sleep(1);
98 continue;
99 }
100
101 VirtualDict* dict = recycle_list.front();
102 recycle_list.pop();
103 recycle->unlock();
104
105 while (dict->atom_seek_num() != 0) {
106 sleep(1);
107 }
108
109 int ret = dict->destroy();
110 if (ret != 0) {
111 LOG(WARNING) << "destroy dict failed";
112 }
113
114 delete dict;
115 }
116
117 return NULL;
118}
119
120} // namespace mcube
121} // namespace rec

Callers

nothing calls this directly

Calls 6

lockMethod · 0.80
emptyMethod · 0.80
unlockMethod · 0.45
frontMethod · 0.45
atom_seek_numMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected