Lines Matching refs:once
11 struct once { struct
16 static inline void __once_init(struct once *once, const char *name, in __once_init() argument
19 atomic_set(&once->state, ONCE_NOT_STARTED); in __once_init()
20 __mutex_init(&once->lock, name, key); in __once_init()
23 #define once_init(once) \ argument
26 __once_init((once), #once, &__key); \
44 static inline int call_once(struct once *once, int (*cb)(struct once *)) in call_once() argument
49 if (atomic_read_acquire(&once->state) == ONCE_COMPLETED) in call_once()
52 guard(mutex)(&once->lock); in call_once()
53 state = atomic_read(&once->state); in call_once()
57 atomic_set(&once->state, ONCE_RUNNING); in call_once()
58 r = cb(once); in call_once()
60 atomic_set(&once->state, ONCE_NOT_STARTED); in call_once()
62 atomic_set_release(&once->state, ONCE_COMPLETED); in call_once()