MCPcopy Create free account
hub / github.com/Tencent/libco / Consumer

Function Consumer

example_cond.cpp:50–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 return NULL;
49}
50void* Consumer(void* args)
51{
52 co_enable_hook_sys();
53 stEnv_t* env = (stEnv_t*)args;
54 while (true)
55 {
56 if (env->task_queue.empty())
57 {
58 co_cond_timedwait(env->cond, -1);
59 continue;
60 }
61 stTask_t* task = env->task_queue.front();
62 env->task_queue.pop();
63 printf("%s:%d consume task %d\n", __func__, __LINE__, task->id);
64 free(task);
65 }
66 return NULL;
67}
68int main()
69{
70 stEnv_t* env = new stEnv_t;

Callers

nothing calls this directly

Calls 2

co_enable_hook_sysFunction · 0.85
co_cond_timedwaitFunction · 0.85

Tested by

no test coverage detected