1 /***** public prototypes *****/
2 #include "../inc/liblfds700.h"
10 #define LFDS700_ABSTRACTION_BACKOFF_LIMIT (0x1 << 10)
12 #if( defined _KERNEL_MODE )
13 #define MODE_TYPE_STRING "kernel-mode"
16 #if( !defined _KERNEL_MODE )
17 #define MODE_TYPE_STRING "user-mode"
20 #if( defined NDEBUG && !defined COVERAGE && !defined TSAN )
21 #define BUILD_TYPE_STRING "release"
24 #if( !defined NDEBUG && !defined COVERAGE && !defined TSAN )
25 #define BUILD_TYPE_STRING "debug"
28 #if( !defined NDEBUG && defined COVERAGE && !defined TSAN )
29 #define BUILD_TYPE_STRING "coverage"
32 #if( !defined NDEBUG && !defined COVERAGE && defined TSAN )
33 #define BUILD_TYPE_STRING "threadsanitizer"
36 // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration
37 #define LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result, backoff_iteration, ps ) \
39 LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ); \
46 lfds700_pal_uint_t volatile \
49 if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \
50 (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \
52 if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \
53 (backoff_iteration) = 1; \
56 endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas; \
57 for( loop = 0 ; loop < endloop ; loop++ ); \
60 (backoff_iteration) <<= 1; \
64 // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration
65 #define LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result, backoff_iteration, ps ) \
67 LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ); \
74 lfds700_pal_uint_t volatile \
77 if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \
78 (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \
80 if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \
81 (backoff_iteration) = 1; \
84 endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; \
85 for( loop = 0 ; loop < endloop ; loop++ ); \
88 (backoff_iteration) <<= 1; \
92 /***** library-wide prototypes *****/