int gsd_enable, ret;
#define MS 1000
- while (1) {
+ while (__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) {
gsd_enable = 0;
for (i = 0; i < IFPGA_RAWDEV_NUM; i++) {
ifpga_rdev = &ifpga_rawdevices[i];
{
int ret;
- if (ifpga_monitor_start == 0) {
+ if (!__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) {
ret = rte_ctrl_thread_create(&ifpga_monitor_start_thread,
"ifpga-monitor", NULL,
ifpga_rawdev_gsd_handle, NULL);
"Fail to create ifpga monitor thread");
return -1;
}
- ifpga_monitor_start = 1;
+ __atomic_store_n(&ifpga_monitor_start, 1, __ATOMIC_RELAXED);
}
return 0;
{
int ret;
- if (ifpga_monitor_start == 1) {
+ if (__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) {
+ __atomic_store_n(&ifpga_monitor_start, 0, __ATOMIC_RELAXED);
+
ret = pthread_cancel(ifpga_monitor_start_thread);
if (ret)
IFPGA_RAWDEV_PMD_ERR("Can't cancel the thread");
if (ret)
IFPGA_RAWDEV_PMD_ERR("Can't join the thread");
- ifpga_monitor_start = 0;
-
return ret;
}