Repository navigation
Refactor backend-v4l::named_mutex - #14095
Merged
Merged
Conversation
OhadMeir
marked this pull request as ready for review
June 25, 2025 12:08
Contributor
There was a problem hiding this comment.
Pull Request Overview
Refactor the named_mutex in the V4L2 backend to use RAII for file descriptors and an atomic counter for lock tracking, remove legacy maps and recursive mutexes, switch to Linux OFD locks, and introduce a UVC power stress test.
- Replaced per-device recursive mutex maps and lock counters with a single
std::atomic<int>counter. - Simplified constructor/destructor to open/close the device file descriptor directly.
- Refactored
lock(),unlock(), andtry_lock()to usefcntl-based OFD locking. - Added a multi-threaded UVC power stress test (
test-uvc-power-stress-test.py).
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| unit-tests/live/options/test-uvc-power-stress-test.py | Added a stress test to exercise concurrent UVC power-option commands across multiple threads. |
| src/linux/backend-v4l2.h | Removed legacy recursive mutexes and maps; introduced std::atomic<int> _lock_counter. |
| src/linux/backend-v4l2.cpp | Refactored named_mutex methods to use OFD locks via fcntl, and simplified file descriptor RAII. |
Nir-Az
reviewed
Jul 3, 2025
Nir-Az
reviewed
Jul 3, 2025
Nir-Az
reviewed
Jul 3, 2025
Nir-Az
reviewed
Jul 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracked on [RSDSO-20187]
named_mutexholding file descriptor (RAII).Removed unnecessary locks and counters for file descriptor open/close.
Using atomic int as lock counter.