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

Function test_htable_rwlock

unit_test/stdlib/test_htable.c:172–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172int test_htable_rwlock(AUT_LINE *test_line, void *arg acl_unused)
173{
174 acl_pthread_pool_t *tp;
175 int threads = 100, thread_idle = 120;
176 int i, n = 1000;
177 ACL_HASH_FN hash_fn;
178 const char *ptr;
179
180 AUT_SET_STR(test_line, "hash_fn", ptr);
181
182 hash_fn = __get_hash_fn(ptr);
183
184 __rwlock_ctx.test_line = test_line;
185 __rwlock_ctx.table = acl_htable_create(10, ACL_HTABLE_FLAG_USE_LOCK);
186
187 acl_htable_ctl(__rwlock_ctx.table,
188 ACL_HTABLE_CTL_RWLOCK, TRUE,
189 ACL_HTABLE_CTL_HASH_FN, hash_fn,
190 ACL_HTABLE_CTL_END);
191
192 tp = acl_thread_pool_create(threads, thread_idle);
193
194 for (i = 0; i < n; i++) {
195 acl_pthread_pool_add(tp, __htable_rwlock_fn, &__rwlock_ctx);
196 }
197
198 sleep(2);
199
200 acl_pthread_pool_stop(tp);
201 acl_htable_stat(__rwlock_ctx.table);
202
203 acl_htable_free(__rwlock_ctx.table, (void (*) (void *))acl_myfree_fn);
204 __rwlock_ctx.test_line = NULL;
205 __rwlock_ctx.table = NULL;
206
207 return (0);
208}

Callers

nothing calls this directly

Calls 8

__get_hash_fnFunction · 0.85
acl_htable_createFunction · 0.85
acl_htable_ctlFunction · 0.85
acl_thread_pool_createFunction · 0.85
acl_pthread_pool_stopFunction · 0.85
acl_htable_statFunction · 0.85
acl_htable_freeFunction · 0.85
sleepFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…