| 463 | } |
| 464 | |
| 465 | static void *xh_core_refresh_thread_func(void *arg) |
| 466 | { |
| 467 | (void)arg; |
| 468 | |
| 469 | pthread_setname_np(pthread_self(), "xh_refresh_loop"); |
| 470 | |
| 471 | while(xh_core_refresh_thread_running) |
| 472 | { |
| 473 | //waiting for a refresh task or exit |
| 474 | pthread_mutex_lock(&xh_core_mutex); |
| 475 | while(!xh_core_refresh_thread_do && xh_core_refresh_thread_running) |
| 476 | { |
| 477 | pthread_cond_wait(&xh_core_cond, &xh_core_mutex); |
| 478 | } |
| 479 | if(!xh_core_refresh_thread_running) |
| 480 | { |
| 481 | pthread_mutex_unlock(&xh_core_mutex); |
| 482 | break; |
| 483 | } |
| 484 | xh_core_refresh_thread_do = 0; |
| 485 | pthread_mutex_unlock(&xh_core_mutex); |
| 486 | |
| 487 | //refresh |
| 488 | pthread_mutex_lock(&xh_core_refresh_mutex); |
| 489 | xh_core_refresh_impl(); |
| 490 | pthread_mutex_unlock(&xh_core_refresh_mutex); |
| 491 | } |
| 492 | |
| 493 | return NULL; |
| 494 | } |
| 495 | |
| 496 | static void xh_core_init_once() |
| 497 | { |
nothing calls this directly
no test coverage detected