| 226 | |
| 227 | static acl_pthread_once_t once_control = ACL_PTHREAD_ONCE_INIT; |
| 228 | static void *test_once_thread(void *arg acl_unused) |
| 229 | { |
| 230 | ACL_VSTRING *buf; |
| 231 | static acl_pthread_key_t buf_key = -1; |
| 232 | static __thread ACL_VSTRING *__vbuf = NULL; |
| 233 | |
| 234 | acl_pthread_once(&once_control, init_once); |
| 235 | |
| 236 | if (__vbuf == NULL) { |
| 237 | __vbuf = acl_vstring_alloc(256); |
| 238 | acl_pthread_atexit_add(__vbuf, free_vbuf); |
| 239 | } |
| 240 | |
| 241 | buf = (ACL_VSTRING*) acl_pthread_tls_get(&buf_key); |
| 242 | if (buf == NULL) { |
| 243 | buf = acl_vstring_alloc(256); |
| 244 | acl_pthread_tls_set(buf_key, buf, free_buf); |
| 245 | } |
| 246 | |
| 247 | buf = (ACL_VSTRING*) acl_pthread_tls_get(&buf_key); |
| 248 | if (buf == NULL) |
| 249 | printf(">>>%s(tid=%d) buf null\n", __FUNCTION__, (int) acl_pthread_self()); |
| 250 | else |
| 251 | printf(">>>%s(tid=%d) buf not null\n", __FUNCTION__, (int) acl_pthread_self()); |
| 252 | |
| 253 | printf(">>>%s: in thread %d, last error: %s\n", |
| 254 | __FUNCTION__, (int) acl_pthread_self(), acl_last_serror()); |
| 255 | |
| 256 | return (NULL); |
| 257 | } |
| 258 | |
| 259 | static void test_pthread_once(void) |
| 260 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…