ck_elide: Fold CK_ELIDE_ADAPTIVE_PROTOTYPE into PROTOTYPE.

ck_pring
Samy Al Bahra 12 years ago
parent b67e91c858
commit 906eaf1881

@ -125,7 +125,16 @@ _ck_elide_fallback(int *retry,
return CK_ELIDE_HINT_STOP;
}
#define CK_ELIDE_ADAPTIVE_PROTOTYPE(N, T, L_P, L, U_P, U) \
/*
* Defines an elision implementation according to the following variables:
* N - Namespace of elision implementation.
* T - Typename of mutex.
* L_P - Lock predicate, returns false if resource is available.
* L - Function to call if resource is unavailable of transaction aborts.
* U_P - Unlock predicate, returns false if elision failed.
* U - Function to call if transaction failed.
*/
#define CK_ELIDE_PROTOTYPE(N, T, L_P, L, U_P, U) \
CK_CC_INLINE static void \
ck_elide_##N##_lock_adaptive(T *lock, \
struct ck_elide_stat *st, \
@ -185,22 +194,7 @@ _ck_elide_fallback(int *retry,
} \
\
return; \
}
/*
* Defines an elision implementation according to the following variables:
* N - Namespace of elision implementation.
* T - Typename of mutex.
* L_P - Lock predicate, returns false if resource is available.
* L - Function to call if resource is unavailable of transaction aborts.
* U_P - Unlock predicate, returns false if elision failed.
* U - Function to call if transaction failed.
*
* Unlike the adaptive variant, this interface does not have any retry
* semantics. In environments where jitter is low, this may yield a tighter
* fast path.
*/
#define CK_ELIDE_PROTOTYPE(N, T, L_P, L, U_P, U) \
} \
CK_CC_INLINE static void \
ck_elide_##N##_lock(T *lock) \
{ \
@ -249,7 +243,7 @@ _ck_elide_fallback(int *retry,
* are paid (typically a storage cost that is a function of lock objects and
* thread count).
*/
#define CK_ELIDE_ADAPTIVE_PROTOTYPE(N, T, L_P, L, U_P, U) \
#define CK_ELIDE_PROTOTYPE(N, T, L_P, L, U_P, U) \
CK_CC_INLINE static void \
ck_elide_##N##_lock_adaptive(T *lock, \
struct ck_elide_stat *st, \
@ -269,9 +263,7 @@ _ck_elide_fallback(int *retry,
(void)st; \
U(lock); \
return; \
}
#define CK_ELIDE_PROTOTYPE(N, T, L_P, L, U_P, U) \
} \
CK_CC_INLINE static void \
ck_elide_##N##_lock(T *lock) \
{ \
@ -300,6 +292,10 @@ _ck_elide_fallback(int *retry,
* Best-effort elision lock operations. First argument is name (N)
* associated with implementation and the second is a pointer to
* the type specified above (T).
*
* Unlike the adaptive variant, this interface does not have any retry
* semantics. In environments where jitter is low, this may yield a tighter
* fast path.
*/
#define CK_ELIDE_LOCK(NAME, LOCK) ck_elide_##NAME##_lock(LOCK)
#define CK_ELIDE_UNLOCK(NAME, LOCK) ck_elide_##NAME##_unlock(LOCK)

Loading…
Cancel
Save