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;
107 typedef void (closure_fn) (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;
169 void closure_sub(struct closure *cl, int v);
170 void closure_put(struct closure *cl);
172 bool closure_wait(struct closure_waitlist *list, struct closure *cl);
173 void __closure_sync(struct closure *cl);
176 * closure_sync - sleep until a closure a closure has nothing left to wait on
178 * Sleeps until the refcount hits 1 - the thread that's running the closure owns
181 static inline void closure_sync(struct closure *cl)
190 void closure_debug_create(struct closure *cl);
191 void closure_debug_destroy(struct closure *cl);
196 static inline void closure_debug_create(struct closure *cl) {}
197 static inline void closure_debug_destroy(struct closure *cl) {}
201 static inline void closure_set_ip(struct closure *cl)
208 static inline void closure_set_ret_ip(struct closure *cl)
215 static inline void closure_set_waiting(struct closure *cl, unsigned long f)
222 static inline void closure_set_stopped(struct closure *cl)
227 static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
237 static inline void closure_queue(struct closure *cl)
241 * Changes made to closure, work_struct, or a couple of other structs
244 BUILD_BUG_ON(offsetof(struct closure, fn)
254 * closure_get - increment a closure's refcount
256 static inline void closure_get(struct closure *cl)
267 * closure_init - Initialize a closure, setting the refcount to 1
268 * @cl: closure to initialize
269 * @parent: parent of the new closure. cl will take a refcount on it for its
272 static inline void closure_init(struct closure *cl, struct closure *parent)
274 memset(cl, 0, sizeof(struct closure));
285 static inline void closure_init_stack(struct closure *cl)
287 memset(cl, 0, sizeof(struct closure));
310 * and whatever @cl owns may be freed out from under you - a running closure fn
311 * has a ref on its own closure which continue_at() drops.
322 * closure_return - finish execution of a closure
325 * @cl have been dropped @cl's ref on its parent closure (as passed to
327 * thought of as returning to the parent closure.
348 * closure_return_with_destructor - finish execution of a closure,
354 * closure still held - so @destructor could safely return an item to a
364 * closure_call - execute @fn out of a new, uninitialized closure
366 * Typically used when running out of one closure, and we want to run @fn
367 * asynchronously out of a new closure - @parent will then wait for @cl to
370 static inline void closure_call(struct closure *cl, closure_fn fn,
372 struct closure *parent)