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

Function servers_start

lib_fiber/cpp/src/fiber_server.cpp:863–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

861}
862
863static void servers_start(FIBER_SERVER **servers, int nthreads)
864{
865 acl_pthread_attr_t attr;
866 int i;
867
868 if (nthreads <= 0) {
869 acl_msg_fatal("%s(%d), %s: invalid nthreads %d",
870 __FILE__, __LINE__, __FUNCTION__, nthreads);
871 }
872
873 /* this can only be called in the main thread */
874 if (__server_on_listen) {
875 for (i = 0; i < nthreads; i++) {
876 FIBER_SERVER *server = servers[i];
877 int j;
878
879 for (j = 0; j < server->socket_count; j++) {
880 __server_on_listen(__service_ctx,
881 server->sstreams[j]);
882 }
883 }
884 }
885
886 __clock = acl_atomic_clock_alloc();
887 acl_pthread_attr_init(&attr);
888 acl_pthread_attr_setdetachstate(&attr, ACL_PTHREAD_CREATE_DETACHED);
889
890 for (i = 0; i < nthreads; i++) {
891 acl_pthread_create(&servers[i]->tid, &attr,
892 thread_main, servers[i]);
893 }
894
895 main_thread_loop();
896}
897
898static void open_service_log()
899{

Callers 1

acl_fiber_server_mainFunction · 0.70

Calls 6

acl_msg_fatalFunction · 0.85
acl_atomic_clock_allocFunction · 0.85
acl_pthread_attr_initFunction · 0.85
acl_pthread_createFunction · 0.85
main_thread_loopFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…