Lines Matching refs:closure

27  * wait synchronously, use closure_sync() - you will sleep until your closure's
63 * If closure's refcount started at 0, complete_some_read() could run before the
66 * complete_some_read()'s thread owned the closure - and whatever state it was
69 * So, closure_init() initializes a closure's refcount to 1 - and when a
74 * on a closure because you called closure_init() or you were run out of a
75 * closure - _always_ use continue_at(). Doing so consistently will help
82 * closure was already on a wait list or not - a closure can only be on one wait
87 * closure_init() takes two arguments - it takes the closure to initialize, and
90 * If parent is non null, the new closure will have a refcount for its lifetime;
91 * a closure is considered to be "finished" when its refcount hits 0 and the
100 * All this implies that a closure should typically be embedded in a particular
105 struct closure;
116 * CLOSURE_WAITING: Set iff the closure is on a waitlist. Must be set by
117 * the thread that owns the closure, and cleared by the thread that's
118 * waking up the closure.
122 * CLOSURE_RUNNING: Set when a closure is running (i.e. by
143 struct closure {
154 struct closure *parent;
170 void closure_sub(struct closure *cl, int v);
171 void closure_put(struct closure *cl);
173 bool closure_wait(struct closure_waitlist *list, struct closure *cl);
174 void __closure_sync(struct closure *cl);
176 static inline unsigned closure_nr_remaining(struct closure *cl)
182 * closure_sync - sleep until a closure a closure has nothing left to wait on
184 * Sleeps until the refcount hits 1 - the thread that's running the closure owns
187 static inline void closure_sync(struct closure *cl)
199 void closure_debug_create(struct closure *cl);
200 void closure_debug_destroy(struct closure *cl);
204 static inline void closure_debug_create(struct closure *cl) {}
205 static inline void closure_debug_destroy(struct closure *cl) {}
209 static inline void closure_set_ip(struct closure *cl)
216 static inline void closure_set_ret_ip(struct closure *cl)
223 static inline void closure_set_waiting(struct closure *cl, unsigned long f)
230 static inline void closure_set_stopped(struct closure *cl)
235 static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
243 static inline void closure_queue(struct closure *cl)
247 * Changes made to closure, work_struct, or a couple of other structs
250 BUILD_BUG_ON(offsetof(struct closure, fn)
261 * closure_get - increment a closure's refcount
263 static inline void closure_get(struct closure *cl)
276 * closure_init - Initialize a closure, setting the refcount to 1
277 * @cl: closure to initialize
278 * @parent: parent of the new closure. cl will take a refcount on it for its
281 static inline void closure_init(struct closure *cl, struct closure *parent)
295 static inline void closure_init_stack(struct closure *cl)
297 memset(cl, 0, sizeof(struct closure));
314 struct closure *cl = container_of(ws, struct closure, work); \
325 * and whatever @cl owns may be freed out from under you - a running closure fn
326 * has a ref on its own closure which continue_at() drops.
337 * closure_return - finish execution of a closure
340 * @cl have been dropped @cl's ref on its parent closure (as passed to
342 * thought of as returning to the parent closure.
363 * closure_return_with_destructor - finish execution of a closure,
369 * closure still held - so @destructor could safely return an item to a
379 * closure_call - execute @fn out of a new, uninitialized closure
381 * Typically used when running out of one closure, and we want to run @fn
382 * asynchronously out of a new closure - @parent will then wait for @cl to
385 static inline void closure_call(struct closure *cl, closure_fn fn,
387 struct closure *parent)
395 struct closure cl; \