if(x<=1)
return __canque_edge_decref(edge);
y=x;
+ #ifdef CAN_HAVE_ATOMIC_CMPXCHG
+ atomic_cmpxchg(&edge->edge_used, x, x-1);
+ #else /* workaround for case that atomic_cmpxchg is not defined */
/* This code strongly depends on the definition of atomic_t !!!! */
- /* x=cmpxchg(&edge->edge_used, x, x-1); */
- /* Next alternative could be more portable */
x=__cmpxchg(&edge->edge_used, x, x-1, sizeof(atomic_t));
/* If even this does not help, comment out CAN_HAVE_ARCH_CMPXCHG in can_sysdep.h */
+ #endif
} while(x!=y);
}
#endif