Fix macros for testing presence of atomic LIFO
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
be327f5e56
commit
263d8016b8
4 changed files with 12 additions and 12 deletions
|
@ -25,11 +25,11 @@ extern "C" {
|
|||
|
||||
#define FREELIST_TYPE FREELIST_DOUBLE
|
||||
|
||||
#if 0
|
||||
#if HAVE_ATOMIC_LIFO
|
||||
#ifndef FREELIST_TYPE
|
||||
#if DDSRT_HAVE_ATOMIC_LIFO
|
||||
#define FREELIST_TYPE FREELIST_ATOMIC_LIFO
|
||||
#else
|
||||
#define FREELIST_TYPE FREELIST_SIMPLE
|
||||
#define FREELIST_TYPE FREELIST_DOUBLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,7 @@ struct nn_freelist {
|
|||
ddsrt_atomic_lifo_t x;
|
||||
ddsrt_atomic_uint32_t count;
|
||||
uint32_t max;
|
||||
off_t linkoff;
|
||||
size_t linkoff;
|
||||
};
|
||||
|
||||
#elif FREELIST_TYPE == FREELIST_DOUBLE
|
||||
|
@ -73,12 +73,12 @@ struct nn_freelist {
|
|||
struct nn_freelistM *emlist;
|
||||
uint32_t count;
|
||||
uint32_t max;
|
||||
off_t linkoff;
|
||||
size_t linkoff;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, off_t linkoff);
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, size_t linkoff);
|
||||
void nn_freelist_fini (struct nn_freelist *fl, void (*free) (void *elem));
|
||||
bool nn_freelist_push (struct nn_freelist *fl, void *elem);
|
||||
void *nn_freelist_pushmany (struct nn_freelist *fl, void *first, void *last, uint32_t n);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#if FREELIST_TYPE == FREELIST_NONE
|
||||
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, off_t linkoff)
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, size_t linkoff)
|
||||
{
|
||||
(void) fl; (void) max; (void) linkoff;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void *nn_freelist_pop (struct nn_freelist *fl)
|
|||
|
||||
#elif FREELIST_TYPE == FREELIST_ATOMIC_LIFO
|
||||
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, off_t linkoff)
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, size_t linkoff)
|
||||
{
|
||||
ddsrt_atomic_lifo_init (&fl->x);
|
||||
ddsrt_atomic_st32(&fl->count, 0);
|
||||
|
@ -104,7 +104,7 @@ void *nn_freelist_pop (struct nn_freelist *fl)
|
|||
|
||||
static ddsrt_thread_local int freelist_inner_idx = -1;
|
||||
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, off_t linkoff)
|
||||
void nn_freelist_init (struct nn_freelist *fl, uint32_t max, size_t linkoff)
|
||||
{
|
||||
int i;
|
||||
ddsrt_mutex_init (&fl->lock);
|
||||
|
|
|
@ -40,4 +40,4 @@ DDS_EXPORT void ddsrt_circlist_remove (struct ddsrt_circlist *list, struct ddsrt
|
|||
DDS_EXPORT struct ddsrt_circlist_elem *ddsrt_circlist_oldest (const struct ddsrt_circlist *list);
|
||||
DDS_EXPORT struct ddsrt_circlist_elem *ddsrt_circlist_latest (const struct ddsrt_circlist *list);
|
||||
|
||||
#endif /* DDSRT_CIRCLIST_H */
|
||||
#endif /* DDSRT_CIRCLIST_H */
|
||||
|
|
|
@ -119,7 +119,7 @@ extern inline int ddsrt_atomic_cas64 (volatile ddsrt_atomic_uint64_t *x, uint64_
|
|||
#endif
|
||||
extern inline int ddsrt_atomic_casptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t exp, uintptr_t des);
|
||||
extern inline int ddsrt_atomic_casvoidp (volatile ddsrt_atomic_voidp_t *x, void *exp, void *des);
|
||||
#if DDSRT_ATOMIC_LIFO_SUPPORT
|
||||
#if DDSRT_HAVE_ATOMIC_LIFO
|
||||
extern inline int ddsrt_atomic_casvoidp2 (volatile ddsrt_atomic_uintptr2_t *x, uintptr_t a0, uintptr_t b0, uintptr_t a1, uintptr_t b1);
|
||||
#endif
|
||||
/* FENCES */
|
||||
|
@ -129,7 +129,7 @@ extern inline void ddsrt_atomic_fence_stst (void);
|
|||
extern inline void ddsrt_atomic_fence_acq (void);
|
||||
extern inline void ddsrt_atomic_fence_rel (void);
|
||||
|
||||
#if DDSRT_ATOMIC_LIFO_SUPPORT
|
||||
#if DDSRT_HAVE_ATOMIC_LIFO
|
||||
void ddsrt_atomic_lifo_init (ddsrt_atomic_lifo_t *head)
|
||||
{
|
||||
head->aba_head.s.a = head->aba_head.s.b = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue