| 87 | } |
| 88 | |
| 89 | static 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 | |
| 125 | static void main_thread_atexit(void *arg) |
| 126 | { |
no test coverage detected
searching dependent graphs…