What is the worker process execution flow in php-fpm

look at the worker process creation section of the php-fpm source code, and there is one thing I don"t understand.
when php-fpm is initially started, the execution flow is as follows:
main-> fpm_run-> fpm_children_create_initial-> fpm_children_make
then the worker process will execute the logic after the fpm_run call in the main function and enter an infinite loop. However, in ondemand mode, the initialization does not create a worker process, but adds an IO event callback to listen for listen-socket readable events. A worker process is created only when there is a new connection. Refer to the following code, but what is the execution logic of the worker process after the worker process is created? Look at the code and return it directly.
I hope you can give me some advice if you know anything about it. Thank you

.
// fpm/fpm_children.c 
int fpm_children_create_initial(struct fpm_worker_pool_s *wp) /* {{{ */
{
    if (wp->config->pm == PM_STYLE_ONDEMAND) {
        ....
        memset(wp->ondemand_event, 0, sizeof(struct fpm_event_s));
        fpm_event_set(wp->ondemand_event, wp->listening_socket, FPM_EV_READ | FPM_EV_EDGE, fpm_pctl_on_socket_accept, wp);
        wp->socket_event_set = 1;
        fpm_event_add(wp->ondemand_event, 0);
        return 1;
    }
    return fpm_children_make(wp, 0 /* not in event loop yet */, 0, 1);
}
// fpm/fpm_process_ctl.c
void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg)
{
    ....
    wp->warn_max_children = 0;
    fpm_children_make(wp, 1, 1, 1);

    if (fpm_globals.is_child) {
        return;
    }
}
Php
Mar.20,2021
Menu