eal: simplify control thread creation
[dpdk.git] / lib / eal / common / eal_common_launch.c
index 34f854a..e95dadf 100644 (file)
 int
 rte_eal_wait_lcore(unsigned worker_id)
 {
-       if (lcore_config[worker_id].state == WAIT)
-               return 0;
-
-       while (lcore_config[worker_id].state != WAIT &&
-              lcore_config[worker_id].state != FINISHED)
+       while (__atomic_load_n(&lcore_config[worker_id].state,
+                                       __ATOMIC_ACQUIRE) != WAIT)
                rte_pause();
 
-       rte_rmb();
-
-       /* we are in finished state, go to wait state */
-       lcore_config[worker_id].state = WAIT;
        return lcore_config[worker_id].ret;
 }
 
@@ -62,7 +55,7 @@ rte_eal_mp_remote_launch(int (*f)(void *), void *arg,
 
        if (call_main == CALL_MAIN) {
                lcore_config[main_lcore].ret = f(arg);
-               lcore_config[main_lcore].state = FINISHED;
+               lcore_config[main_lcore].state = WAIT;
        }
 
        return 0;