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

Function main_thread_loop

lib_fiber/cpp/src/fiber_server.cpp:687–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687static void main_thread_loop()
688{
689#if !defined(_WIN32) && !defined(_WIN64)
690 if (__daemon_mode) {
691 ACL_VSTREAM *stat_stream = acl_vstream_fdopen(
692 ACL_MASTER_STATUS_FD, O_RDWR, 8192, -1,
693 ACL_VSTREAM_TYPE_SOCK);
694
695 acl_fiber_create(main_fiber_monitor_master,
696 stat_stream, STACK_SIZE);
697 acl_close_on_exec(ACL_MASTER_STATUS_FD, ACL_CLOSE_ON_EXEC);
698 acl_close_on_exec(ACL_MASTER_FLOW_READ, ACL_CLOSE_ON_EXEC);
699 acl_close_on_exec(ACL_MASTER_FLOW_WRITE, ACL_CLOSE_ON_EXEC);
700 if (acl_var_fiber_dispatch_addr && *acl_var_fiber_dispatch_addr) {
701 acl_fiber_create(main_fiber_dispatch, NULL, STACK_SIZE);
702 }
703 }
704#endif
705
706 ACL_FIBER_ATTR attr;
707
708 acl_fiber_attr_init(&attr);
709 acl_fiber_attr_setstacksize(&attr, acl_var_fiber_stack_size);
710 acl_fiber_attr_setsharestack(&attr, acl_var_fiber_share_stack ? 1 : 0);
711
712 __sighup_fiber = acl_fiber_create2(&attr, main_fiber_sighup, NULL);
713
714 if (acl_var_fiber_use_limit > 0) {
715 acl_fiber_create(main_fiber_monitor_used, NULL, STACK_SIZE);
716 }
717
718 if (acl_var_fiber_idle_limit > 0) {
719 acl_fiber_create(main_fiber_monitor_idle, NULL, STACK_SIZE);
720 }
721
722 acl_server_sighup_setup();
723 acl_server_sigterm_setup();
724
725 acl_msg_info("daemon started, log=%s, ev=%d", acl_var_fiber_log_file,
726 __fiber_schedule_event);
727 acl_fiber_schedule_with(__fiber_schedule_event);
728 acl_msg_info("daemon stopped now, exit status=%d", __exit_status);
729 exit(__exit_status);
730}
731
732static FIBER_SERVER *server_alloc(int socket_count, int fdtype)
733{

Callers 1

servers_startFunction · 0.70

Calls 10

acl_close_on_execFunction · 0.85
acl_fiber_attr_initFunction · 0.85
acl_fiber_create2Function · 0.85
acl_server_sighup_setupFunction · 0.85
acl_server_sigterm_setupFunction · 0.85
acl_msg_infoFunction · 0.85
acl_fiber_schedule_withFunction · 0.85
acl_fiber_createFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…