Using the atomic_t created a dependency on an atomic header.  It's not a
huge deal, since most every place that uses run_once() was already
including the header, but it was a minor annoyance.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <[email protected]>
---
 kern/include/ros/common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kern/include/ros/common.h b/kern/include/ros/common.h
index f55504c77a6d..eda5dab493d9 100644
--- a/kern/include/ros/common.h
+++ b/kern/include/ros/common.h
@@ -159,9 +159,10 @@ static inline bool mult_will_overflow_u64(uint64_t a, 
uint64_t b)
 #define run_once(func)                                                         
\
 do {                                                                           
\
        static bool ran_once = FALSE;                                           
   \
-       static atomic_t is_running = FALSE;                                     
   \
+       static bool is_running = FALSE;                                         
   \
        if (!ran_once) {                                                        
   \
-               if (!atomic_swap(&is_running, TRUE)) {                          
       \
+               /* fetch and set TRUE, without a header or test_and_set 
weirdness */   \
+               if (!__sync_fetch_and_or(&is_running, TRUE)) {                  
       \
                        /* we won the race and get to run the func */           
           \
                        func;                                                   
           \
                        wmb();  /* don't let the ran_once write pass previous 
writes */    \
@@ -170,7 +171,6 @@ do {                                                        
                   \
                        /* someone else won, wait til they are done to break 
out */        \
                        while (!ran_once)                                       
           \
                                cpu_relax();                                    
               \
-                                                                               
\
                }                                                               
       \
        }                                                                       
   \
 } while (0)
-- 
2.6.0.rc2.230.g3dd15c0

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to