| 527 | } |
| 528 | |
| 529 | static void xh_core_init_async_once() |
| 530 | { |
| 531 | if(xh_core_async_inited) return; |
| 532 | |
| 533 | pthread_mutex_lock(&xh_core_mutex); |
| 534 | |
| 535 | if(xh_core_async_inited) goto end; |
| 536 | |
| 537 | xh_core_async_inited = 1; |
| 538 | |
| 539 | //create async refresh thread |
| 540 | xh_core_refresh_thread_running = 1; |
| 541 | if(0 != pthread_create(&xh_core_refresh_thread_tid, NULL, &xh_core_refresh_thread_func, NULL)) |
| 542 | { |
| 543 | xh_core_refresh_thread_running = 0; |
| 544 | goto end; |
| 545 | } |
| 546 | |
| 547 | //OK |
| 548 | xh_core_async_init_ok = 1; |
| 549 | |
| 550 | end: |
| 551 | pthread_mutex_unlock(&xh_core_mutex); |
| 552 | } |
| 553 | |
| 554 | int xh_core_refresh(int async) |
| 555 | { |