16 #ifndef included_clib_lock_h 17 #define included_clib_lock_h 22 #define CLIB_PAUSE() __builtin_ia32_pause () 28 #define CLIB_LOCK_DBG(_p) \ 30 (*_p)->frame_address = __builtin_frame_address (0); \ 31 (*_p)->pid = getpid (); \ 32 (*_p)->thread_index = os_get_thread_index (); \ 34 #define CLIB_LOCK_DBG_CLEAR(_p) \ 36 (*_p)->frame_address = 0; \ 38 (*_p)->thread_index = 0; \ 41 #define CLIB_LOCK_DBG(_p) 42 #define CLIB_LOCK_DBG_CLEAR(_p) 144 (*p)->n_readers += 1;
145 if ((*p)->n_readers == 1)
151 (*p)->n_readers_lock = 0;
159 ASSERT ((*p)->n_readers > 0);
165 (*p)->n_readers -= 1;
166 if ((*p)->n_readers == 0)
169 (*p)->writer_lock = 0;
173 (*p)->n_readers_lock = 0;
189 (*p)->writer_lock = 0;
static void clib_rwlock_reader_lock(clib_rwlock_t *p)
volatile u32 n_readers_lock
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static void clib_rwlock_writer_lock(clib_rwlock_t *p)
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void clib_rwlock_free(clib_rwlock_t *p)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static void clib_spinlock_free(clib_spinlock_t *p)
#define CLIB_LOCK_DBG_CLEAR(_p)
#define static_always_inline
#define clib_atomic_test_and_set(a)
static void clib_spinlock_init(clib_spinlock_t *p)
static void clib_rwlock_init(clib_rwlock_t *p)
static void clib_rwlock_reader_unlock(clib_rwlock_t *p)
static void clib_rwlock_writer_unlock(clib_rwlock_t *p)
struct clib_rw_lock_ * clib_rwlock_t
static void clib_mem_free(void *p)
static void * clib_mem_alloc_aligned(uword size, uword align)
#define CLIB_MEMORY_BARRIER()
#define CLIB_CACHE_LINE_BYTES
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
#define CLIB_LOCK_DBG(_p)