Zephyr API Documentation 4.4.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cleanup.h File Reference

SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors SPDX-License-Identifier: Apache-2.0. More...

#include <zephyr/toolchain.h>

Go to the source code of this file.

Macros

#define SCOPE_VAR_DEFINE(_name, _type, _exit_fn, _init_fn, ...)
 Define a scoped variable type.
 
#define SCOPE_GUARD_DEFINE(_name, _type, _lock, _unlock)
 Define a scoped guard type.
 
#define SCOPE_DEFER_DEFINE(_func, ...)
 Define a scoped defer type.
 
#define scope_var(_name, _var)    cleanup_##_name##_t _var __cleanup(cleanup_##_name##_exit) = cleanup_##_name##_init
 Declare a variable with automatic cleanup.
 
#define scope_var_init(_name, _var, _init_expr)    cleanup_##_name##_t _var __cleanup(cleanup_##_name##_exit) = (_init_expr)
 Declare a variable with automatic cleanup using direct initialization.
 
#define scope_guard(_name)   scope_var(guard_##_name, Z_UNIQUE_ID(guard))
 Acquire a scoped guard lock.
 
#define scope_defer(_name)   scope_var(defer_##_name, Z_UNIQUE_ID(defer))
 Register a scoped deferred call.
 

Detailed Description

SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors SPDX-License-Identifier: Apache-2.0.

Cleanup helper API interface