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

Function main_fiber_monitor_idle

lib_fiber/cpp/src/fiber_server.cpp:655–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655static void main_fiber_monitor_idle(ACL_FIBER *fiber, void *ctx acl_unused)
656{
657 time_t last = time(NULL);
658
659 while (1) {
660 if (acl_atomic_clock_users(__clock) > 0) {
661 acl_fiber_sleep(1);
662 time(&last);
663 continue;
664 }
665
666 if (time(NULL) - last >= acl_var_fiber_idle_limit) {
667 break;
668 }
669
670 acl_fiber_sleep(1);
671 }
672
673 acl_msg_info("%s(%d), %s: idle %ld seconds, limit %d,"
674 "users %lld, used %lld", __FILE__, __LINE__, __FUNCTION__,
675 time(NULL) - last, acl_var_fiber_idle_limit,
676 acl_atomic_clock_users(__clock),
677 acl_atomic_clock_count(__clock));
678
679 main_stop_listen();
680 main_server_onexit();
681 main_stop_servers();
682 main_free_servers();
683
684 main_server_exit(fiber, 0);
685}
686
687static void main_thread_loop()
688{

Callers

nothing calls this directly

Calls 9

acl_atomic_clock_usersFunction · 0.85
acl_msg_infoFunction · 0.85
acl_atomic_clock_countFunction · 0.85
main_stop_listenFunction · 0.85
main_server_onexitFunction · 0.85
main_stop_serversFunction · 0.85
main_free_serversFunction · 0.85
main_server_exitFunction · 0.70
acl_fiber_sleepFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…