On Wed, 23 Dec 2015 15:03:15 -0500
Zhihong Wang <zhihong.wang at intel.com> wrote:

> +/* When we receive a INT signal, close all ports */
> +static void
> +sigint_handler(__rte_unused int signum)
> +{
> +     unsigned portid, nb_ports;
> +
> +     printf("Preparing to exit...\n");
> +     nb_ports = rte_eth_dev_count();
> +     for (portid = 0; portid < nb_ports; portid++) {
> +             if ((enabled_port_mask & (1 << portid)) == 0) {
> +                     continue;
> +             }
> +             printf("Stopping port %d...", portid);
> +             rte_eth_dev_stop(portid);
> +             rte_eth_dev_close(portid);
> +             printf(" Done\n");
> +     }
> +     printf("Bye...\n");
> +     exit(0);
> +}

Signal handlers should only set a flag, which is then checked by thread loops.
Calling functions in DPDK from signal handlers is not safe.

Reply via email to