[v2,0/2] libcamera: Introduce and use scope_exit
mbox series

Message ID 20250729162101.13836-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • libcamera: Introduce and use scope_exit
Related show

Message

Laurent Pinchart July 29, 2025, 4:20 p.m. UTC
Hello,

libcamera includes a ScopeExitActions class that simplifies error
handling by gathering cleanup actions for automatic run on scope exit.
The mechanism is quite versatile, but is not suitable for hot paths as
it requires dynamic heap allocation.

This series introduces in patch 1/2 a new simpler scope_exit class that
implements the API defined in the C++ library fundamentals TS v3. It
does not suffer from the same issue as ScopeExitActions, but is less
versatile as a result. Patch 2/2 then uses the new class in
V4L2VideoDevice::queueBuffer() to simplify error handling.

Laurent Pinchart (2):
  libcamera: utils: Add scope_exit class
  libcamera: v4l2_videodevice: Use scope_exit

 include/libcamera/base/utils.h     | 45 ++++++++++++++++++++++++++++++
 src/libcamera/v4l2_videodevice.cpp | 11 ++------
 2 files changed, 48 insertions(+), 8 deletions(-)


base-commit: 2d5a1367e2b14dab9671270655bbb1702e0826de
--
Regards,

Laurent Pinchart