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

Function test_thread_pool

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

Source from the content-addressed store, hash-verified

167}
168
169static 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
191int main(int argc acl_unused, char *argv[] acl_unused)
192{

Callers 1

mainFunction · 0.70

Calls 6

acl_vstream_fopenFunction · 0.85
acl_pthread_mutex_initFunction · 0.85
acl_thread_pool_createFunction · 0.85
acl_pthread_pool_destroyFunction · 0.85
acl_vstream_closeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…