| 170 | } |
| 171 | |
| 172 | int 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…