Skip to content

turnstile

struct turnstile {
struct thread *owner;
bool applied_pi_boost;
enum thread_prio_class prio_class;
struct list_head hash_list;
struct list_head freelist;
size_t waiters;
void *lock_obj;
struct rbt queues[TURNSTILE_NUM_QUEUES];
enum turnstile_state state;
};

struct turnstile referenced types:

struct turnstile_hash_chain {
struct list_head list;
struct spinlock lock;
};

struct turnstile_hash_chain referenced types:

struct turnstile_hash_table {
struct turnstile_hash_chain heads[TURNSTILE_HASH_SIZE];
};

struct turnstile_hash_table referenced types:

enum turnstile_state {
TURNSTILE_STATE_UNUSED,
TURNSTILE_STATE_IN_HASH_TABLE,
TURNSTILE_STATE_IN_FREE_LIST,
};
#define TURNSTILE_WRITER_QUEUE 0
#define TURNSTILE_READER_QUEUE 1
#define TURNSTILE_NUM_QUEUES 2
#define turnstile_from_freelist(fl) \ (container_of(fl, struct turnstile, freelist))
#define turnstile_from_hash_list_node(hln) \ (container_of(hln, struct turnstile, hash_list))
#define TURNSTILE_HASH_SIZE 128
#define TURNSTILE_HASH_MASK (TURNSTILE_HASH_SIZE - 1)
#define TURNSTILE_OBJECT_HASH(obj) \ ((((uintptr_t) (obj) >> 3) * 2654435761u) & TURNSTILE_HASH_MASK)
#define TURNSTILE_CHAIN(sobj) global.turnstiles[TURNSTILE_OBJECT_HASH(sobj)]