MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / callbackThread

Method callbackThread

libapp2sys/src/main/cpp/server.cpp:189–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187 }
188
189 static void* callbackThread(void *args) {
190 pdbg("callbackThread run pid:%d tid:%d", getpid(), gettid());
191 ManufacturerCoder *coder = reinterpret_cast<ManufacturerCoder *>(args);
192 while (1) {
193 IHardCoderDataCallback *callback = coder->callback;
194 amc::DataCallback dataCallback = coder->cbQueue.pop();
195 int type = dataCallback.type();
196
197 if (type == 1) {
198 std::list<int> cbl = coder->systemEventCallbackList;
199 if (cbl.empty()) {
200 pdbg("systemEventCallbackList is empty size:%d continue", TOINT(cbl.size()));
201 continue;
202 }
203 std::list<int>::iterator it;
204 for (it = cbl.begin(); it != cbl.end(); ++it) {
205 int len = dataCallback.ByteSize();
206 uint8_t body[len] ;
207 dataCallback.SerializeToArray(body,len);
208 callback->onCallback(*it, FUNC_REG_SYSTEM_EVENT_CALLBACK, 0, 0, 0, 0 , body, len);
209 pdbg("system event callback done for succ uid:%d", *it);
210 }
211
212 } else if (type == 2) {
213 std::list<int> cbl = coder->anrCallbackUidList;
214 if (cbl.empty()) {
215 pdbg("anrCallbackUidList is empty size:%d continue", TOINT(cbl.size()));
216 continue;
217 }
218 std::list<int>::iterator it;
219 for (it = cbl.begin(); it != cbl.end(); ++it) {
220 int len = dataCallback.ByteSize();
221 uint8_t body[len];
222 dataCallback.SerializeToArray(body, len);
223 callback->onCallback(*it, FUNC_REG_ANR_CALLBACK, 0, 0, 0, 0, body, len);
224 pdbg("anr callback done for succ uid:%d", *it);
225 }
226 }
227 }
228 pwrn("callbackThread loop QUIT now.");
229 return NULL;
230 }
231
232 //for test system event
233 static void* testSystemEvent(void *args) {

Callers

nothing calls this directly

Calls 8

popMethod · 0.80
ByteSizeMethod · 0.80
typeMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
onCallbackMethod · 0.45

Tested by

no test coverage detected