X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/341377103dfdc83d2d52e33d78672366db0efe93..5b1805652b70bcf8f56c827e09b18fbf5a77bea6:/lincan/include/can_queue.h diff --git a/lincan/include/can_queue.h b/lincan/include/can_queue.h index 00ac94c..bf9486d 100644 --- a/lincan/include/can_queue.h +++ b/lincan/include/can_queue.h @@ -646,11 +646,13 @@ void canque_edge_decref(struct canque_edge_t *edge) 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