Hi,

________________________________
From: Stephen Hemminger <[email protected]>
Sent: Thursday, September 25, 2025 12:51 AM
To: [email protected] <[email protected]>
Cc: Stephen Hemminger <[email protected]>; Xu, Rosen 
<[email protected]>
Subject: [RFC 3/6] raw/ifpga: avoid use of pthread_cancel

[CAUTION: This email is from outside your organization. Unless you trust the 
sender, do not click on links or open attachments as it may be a fraudulent 
email attempting to steal your information and/or compromise your computer.]

Use refcnt to do controlled shutdown of control thread
rather than using pthread_cancel().

Signed-off-by: Stephen Hemminger <[email protected]>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 5b9b596435..d61927f193 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -573,13 +573,7 @@ ifpga_monitor_stop_func(struct ifpga_rawdev *dev)

        dev->poll_enabled = 0;

-       if (!(rte_atomic_fetch_sub_explicit(&ifpga_monitor_refcnt, 1,
-                       rte_memory_order_relaxed) - 1) &&
-               ifpga_monitor_start_thread.opaque_id != 0) {
-               ret = 
pthread_cancel((pthread_t)ifpga_monitor_start_thread.opaque_id);
-               if (ret)
-                       IFPGA_RAWDEV_PMD_ERR("Can't cancel the thread");
-
+       if (rte_atomic_fetch_sub_explicit(&ifpga_monitor_refcnt, 1, 
rte_memory_order_relaxed) == 1) {
                ret = rte_thread_join(ifpga_monitor_start_thread, NULL);
                if (ret)
                        IFPGA_RAWDEV_PMD_ERR("Can't join the thread");
--
2.47.3

Reviewed-by: Rosen Xu <[email protected]>

Reply via email to