mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
FS-9820 #resolve [Add thread_pool to libks]
This commit is contained in:
@@ -9,6 +9,11 @@ testpools_SOURCES = testpools.c tap.c
|
||||
testpools_CFLAGS = $(AM_CFLAGS)
|
||||
testpools_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += test_thread_pools
|
||||
test_thread_pools_SOURCES = test_thread_pools.c tap.c
|
||||
test_thread_pools_CFLAGS = $(AM_CFLAGS)
|
||||
test_thread_pools_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += testthreadmutex
|
||||
testthreadmutex_SOURCES = testthreadmutex.c tap.c
|
||||
testthreadmutex_CFLAGS = $(AM_CFLAGS)
|
||||
|
@@ -29,12 +29,19 @@ int qtest1(int loops)
|
||||
ks_q_t *q;
|
||||
ks_pool_t *pool;
|
||||
int i;
|
||||
int r = 1;
|
||||
void *pop;
|
||||
|
||||
ks_pool_open(&pool);
|
||||
ks_q_create(&q, pool, loops);
|
||||
|
||||
ks_thread_create(&thread, test1_thread, q, pool);
|
||||
|
||||
if (ks_q_pop_timeout(q, &pop, 500) != KS_STATUS_TIMEOUT) {
|
||||
r = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (i = 0; i < 10000; i++) {
|
||||
int *val = (int *)ks_pool_alloc(pool, sizeof(int));
|
||||
*val = i;
|
||||
@@ -57,11 +64,13 @@ int qtest1(int loops)
|
||||
ks_q_push(q, val);
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
ks_q_destroy(&q);
|
||||
|
||||
ks_pool_close(&pool);
|
||||
|
||||
return 1;
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user