MCPcopy Create free account
hub / github.com/acl-dev/acl / run_thread_pool

Function run_thread_pool

lib_acl/samples/thread/thread_pool1/main.cpp:89–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static void run_thread_pool(acl_pthread_pool_t *thr_pool)
90{
91 THREAD_CTX *ctx; /* �û��Զ������ */
92
93 /* ����ȫ�־�̬���� */
94 __thr_pool = thr_pool;
95
96 /* �����߳̿�ʼʱ�Ļص����� */
97 (void) acl_pthread_pool_atinit(thr_pool, on_thread_init, thr_pool);
98
99 /* �����߳��˳�ʱ�Ļص����� */
100 (void) acl_pthread_pool_atfree(thr_pool, on_thread_exit, thr_pool);
101
102 ctx = (THREAD_CTX*) acl_mycalloc(1, sizeof(THREAD_CTX));
103 assert(ctx);
104 ctx->thr_pool = thr_pool;
105 ctx->i = 0;
106
107 /**
108 * ���̳߳������ӵ�һ�����񣬼�������һ�������߳�
109 * @param wq �̳߳ؾ��
110 * @param worker_thread �����̵߳Ļص�����
111 * @param event_type �˴�д0����
112 * @param ctx �û��������
113 */
114 acl_pthread_pool_add(thr_pool, worker_thread, ctx);
115 sleep(1);
116
117 ctx = (THREAD_CTX*) acl_mycalloc(1, sizeof(THREAD_CTX));
118 assert(ctx);
119 ctx->thr_pool = thr_pool;
120 ctx->i = 1;
121 /* ���̳߳������ӵڶ������񣬼������ڶ��������߳� */
122 acl_pthread_pool_add(thr_pool, worker_thread, ctx);
123}
124
125static void main_thread_atexit(void *arg)
126{

Callers 1

mainFunction · 0.85

Calls 3

acl_pthread_pool_atinitFunction · 0.85
acl_pthread_pool_atfreeFunction · 0.85
sleepFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…