| 167 | } |
| 168 | |
| 169 | static void test_thread_pool(void) |
| 170 | { |
| 171 | acl_pthread_pool_t *thr_pool; |
| 172 | ACL_VSTREAM *fp = acl_vstream_fopen("test.log", O_WRONLY | O_CREAT, 0600, 4096); |
| 173 | int i; |
| 174 | |
| 175 | acl_pthread_mutex_init(&__mutex, NULL); |
| 176 | thr_pool = acl_thread_pool_create(100, 10); |
| 177 | |
| 178 | for (i = 0; i < 1000000; i++) { |
| 179 | RUN_CTX *ctx = (RUN_CTX*) acl_mymalloc(sizeof(RUN_CTX)); |
| 180 | ctx->fp = fp; |
| 181 | ctx->i = i; |
| 182 | acl_pthread_pool_add(thr_pool, run_thread, ctx); |
| 183 | } |
| 184 | |
| 185 | acl_pthread_pool_destroy(thr_pool); |
| 186 | acl_pthread_mutex_destroy(&__mutex); |
| 187 | acl_vstream_close(fp); |
| 188 | printf("last i: %d\r\n", __i); |
| 189 | } |
| 190 | |
| 191 | int main(int argc acl_unused, char *argv[] acl_unused) |
| 192 | { |
no test coverage detected
searching dependent graphs…