libcamera/include
Barnabás Pőcze 9ac914c634 libcamera: base: log: Protect log categories with lock
Log categories may be added from any thread, so it is important to
synchronize access to the `Logger::categories_` list between its two
users: category creation (by LogCategory::create(), which calls
Logger::findCategory() and Logger::registerCategory()); and log level
setting (by Logger::logSetLevel()).

The LogCategory::create() function uses a mutex to serialize category
creation, but Logger::logSetLevel() can access `Logger::categories_`
concurrently without any protection. To fix the issue, move the mutex to
the Logger class, and use it to protect all accesses to the categories
list. This requires moving all the logic of LogCategory::create() to a
new Logger::findOrCreateCategory() function that combines both
Logger::findCategory() and Logger::registerCategory() in order to make
the two operations exacute atomically.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-02-27 11:30:23 +01:00
..
android android: Add missing SPDX headers to Android headers 2022-09-30 21:51:18 +03:00
libcamera libcamera: base: log: Protect log categories with lock 2025-02-27 11:30:23 +01:00
linux include: linux: videodev2: Add generic line based pixel formats 2025-01-08 14:28:35 +01:00
meson.build libcamera: tracing: fix header generation when built as subproject 2022-11-24 14:52:00 +00:00