ext/iodine/fio.c
/* Called within a child process after it starts. */
Called within a child process after it starts.
Called within a child process after it starts .
static void fio_on_fork(void) {
  fio_timer_lock = FIO_LOCK_INIT;
  fio_data->lock = FIO_LOCK_INIT;
  fio_defer_on_fork();
  fio_malloc_after_fork();
  fio_poll_init();
  fio_state_callback_on_fork();
  const size_t limit = fio_data->capa;
  for (size_t i = 0; i < limit; ++i) {
    fd_data(i).sock_lock = FIO_LOCK_INIT;
    fd_data(i).protocol_lock = FIO_LOCK_INIT;
    if (fd_data(i).protocol && fd_data(i).open) {
      fd_data(i).protocol->rsv = 0;
      fio_force_close(fd2uuid(i));
    }
  }
  fio_pubsub_on_fork();
  uint16_t old_active = fio_data->active;
  fio_data->active = 0;
  fio_defer_perform();
  fio_data->active = old_active;
  fio_data->is_worker = 1;
}
static void fio_on_fork ( void ) { fio_timer_lock = FIO_LOCK_INIT ; fio_data -> lock = FIO_LOCK_INIT ; fio_defer_on_fork ( ) ; fio_malloc_after_fork ( ) ; fio_poll_init ( ) ; fio_state_callback_on_fork ( ) ; const size_t limit = fio_data -> capa ; for ( size_t i = 0 ; i < limit ; ++ i ) { fd_data ( i ) . sock_lock = FIO_LOCK_INIT ; fd_data ( i ) . protocol_lock = FIO_LOCK_INIT ; if ( fd_data ( i ) . protocol && fd_data ( i ) . open ) { fd_data ( i ) . protocol -> rsv = 0 ; fio_force_close ( fd2uuid ( i ) ) ; } } fio_pubsub_on_fork ( ) ; uint16_t old_active = fio_data -> active ; fio_data -> active = 0 ; fio_defer_perform ( ) ; fio_data -> active = old_active ; fio_data -> is_worker = 1 ; }
Called within a child process after it starts.
Called within a child process after it starts .
/* don't pass open connections belonging to the parent onto the child. */ /* open without protocol might be waiting for the child (listening) */