On Wed, Sep 24, 2025 at 09:51:13AM -0700, Stephen Hemminger wrote:
> The iavf driver uses a pipe to communicate with control thread.
> By closing the write side of the pipe, the main thread can
> tell the control thread to exit without use of pthread_cancel.
> 
> Signed-off-by: Stephen Hemminger <[email protected]>
> ---

Acked-by: Bruce Richardson <[email protected]>

>  drivers/net/intel/iavf/iavf_vchnl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/intel/iavf/iavf_vchnl.c 
> b/drivers/net/intel/iavf/iavf_vchnl.c
> index b1b7a5bf94..781bae11be 100644
> --- a/drivers/net/intel/iavf/iavf_vchnl.c
> +++ b/drivers/net/intel/iavf/iavf_vchnl.c
> @@ -161,14 +161,14 @@ iavf_dev_event_handler_fini(void)
>       if (rte_atomic_fetch_sub_explicit(&handler->ndev, 1, 
> rte_memory_order_relaxed) - 1 != 0)
>               return;
>  
> -     int unused = pthread_cancel((pthread_t)handler->tid.opaque_id);
> -     RTE_SET_USED(unused);
> -     close(handler->fd[0]);
> +     /* closing the write side of the pipe will cause read() to return 0 in 
> thread */
>       close(handler->fd[1]);
> -     handler->fd[0] = -1;
>       handler->fd[1] = -1;
>  
>       rte_thread_join(handler->tid, NULL);
> +     close(handler->fd[0]);
> +     handler->fd[0] = -1;
> +
>       pthread_mutex_destroy(&handler->lock);
>  
>       struct iavf_event_element *pos, *save_next;
> -- 
> 2.47.3
> 

Reply via email to