12 #define RWLOCK_BIAS 0x1000UL
15 #define MAX_BUSY_LOOPS 1000
16 #undef USE_SCHED_YIELD
19 /* We should make sure these are padded to a cache line */
20 #if defined(SPARC_SPINLOCKS)
21 typedef volatile char spinlock_t
;
22 #elif defined(POWERPC_SPINLOCKS)
23 typedef volatile unsigned long spinlock_t
;
24 #elif defined(INTEL_SPINLOCKS)
25 typedef volatile int spinlock_t
;
26 #elif defined(MIPS_SPINLOCKS)
27 typedef volatile unsigned long spinlock_t
;
29 #error Need to implement spinlock code in spinlock.h
37 int tdb_spinlock(TDB_CONTEXT
*tdb
, int list
, int rw_type
);
38 int tdb_spinunlock(TDB_CONTEXT
*tdb
, int list
, int rw_type
);
39 int tdb_create_rwlocks(int fd
, unsigned int hash_size
);
40 int tdb_clear_spinlocks(TDB_CONTEXT
*tdb
);
42 #else /* !USE_SPINLOCKS */
44 #define tdb_create_rwlocks(fd, hash_size) 0
45 #define tdb_spinlock(tdb, list, rw_type) (-1)
46 #define tdb_spinunlock(tdb, list, rw_type) (-1)
48 int tdb_spinlock(TDB_CONTEXT
*tdb
, int list
, int rw_type
);
49 int tdb_spinunlock(TDB_CONTEXT
*tdb
, int list
, int rw_type
);
50 int tdb_create_rwlocks(int fd
, unsigned int hash_size
);
52 int tdb_clear_spinlocks(TDB_CONTEXT
*tdb
);