On Tue, 6 Sep 2022 10:51:31 +0800
Zhichao Zeng <[email protected]> wrote:
>
> +static void mark_forked(void)
> +{
> + is_forked++;
> +}
> +
This will end up counting application threads as well.
Also, it would need to be atomic.
> /* Launch threads, called at application init(). */
> int
> rte_eal_init(int argc, char **argv)
> @@ -1324,6 +1331,8 @@ rte_eal_init(int argc, char **argv)
>
> eal_mcfg_complete();
>
> + pthread_atfork(NULL, NULL, mark_forked);
> +
> return fctret;
> }
> int
> rte_eal_cleanup(void)
> {
> + if (is_forked)
> + return 0;
> +
rte_eal_cleanup is supposed to be called only once by application.