[WIP] Address feedback on locking access to CameraZoomConfig#894
[WIP] Address feedback on locking access to CameraZoomConfig#894maerki merged 7 commits intobugfix/lock-all-config-accesfrom
Conversation
Co-authored-by: maerki <6221466+maerki@users.noreply.github.com>
Co-authored-by: maerki <6221466+maerki@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors camera parameter access to improve thread safety by introducing private unlocked helper methods for getCameraVerticalDisplacement() and getCameraPitch(). This allows updateZoom() to call these methods without redundant locking since it already holds the paramMutex, while keeping the public methods that acquire the lock for external callers.
- Created private unlocked helper methods to avoid double-locking when already holding
paramMutex - Updated
updateZoom()to use the unlocked versions directly - Maintained thread-safe public interfaces that acquire locks for external callers
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| shared/src/map/camera/MapCamera3d.h | Added private unlocked helper method declarations with documentation; removed fieldOfView member variable (appears unrelated to locking changes) |
| shared/src/map/camera/MapCamera3d.cpp | Implemented unlocked helper methods and refactored public methods to delegate to them; updated updateZoom() to use unlocked versions |
| @@ -213,7 +218,6 @@ class MapCamera3d : public MapCameraInterface, | |||
| Coord focusPointPosition; | |||
| double cameraVerticalDisplacement = 0.0; | |||
| double cameraPitch = 0; // looking up or down | |||
There was a problem hiding this comment.
The fieldOfView member variable has been removed, but this doesn't appear to be related to the locking changes described in the PR. The method getCameraFieldOfView() returns a constant value (42), so this member was likely unused. However, if this deletion is intentional, it should be mentioned in the PR description. If unintentional, the line should be restored.
getCameraVerticalDisplacement()andgetCameraPitch()updateZoom()to call the unlocked versions directly💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.