mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
locking: Introduce __cleanup() based infrastructure
Use __attribute__((__cleanup__(func))) to build: - simple auto-release pointers using __free() - 'classes' with constructor and destructor semantics for scope-based resource management. - lock guards based on the above classes. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org
This commit is contained in:
@@ -125,6 +125,8 @@ static inline void put_task_struct(struct task_struct *t)
|
||||
__put_task_struct(t);
|
||||
}
|
||||
|
||||
DEFINE_FREE(put_task, struct task_struct *, if (_T) put_task_struct(_T))
|
||||
|
||||
static inline void put_task_struct_many(struct task_struct *t, int nr)
|
||||
{
|
||||
if (refcount_sub_and_test(nr, &t->usage))
|
||||
|
Reference in New Issue
Block a user