Skip to content

Singleton backend/device-watcher - #12243

Merged
maloel merged 3 commits into
realsenseai:developmentfrom
maloel:singleton
Oct 3, 2023
Merged

Singleton backend/device-watcher#12243
maloel merged 3 commits into
realsenseai:developmentfrom
maloel:singleton

Conversation

@maloel

@maloel maloel commented Oct 1, 2023

Copy link
Copy Markdown
Contributor
  • Backend and the device-watcher are now both singletons, as it should be
  • Still, they are automatically destroyed (so the watcher stops watching, etc.) when they're no longer needed (when the last context its devices are removed) - and also automatically created when they're needed
  • Removed create_backend() from the backend.h header, so it's not possible for others to call it
  • Removed context.get_backend() - the backend is now only for backend_device objects
  • Renamed ds_device (recently added by myself) as backend_device and moved out of ds/

The backend is now mostly separate from the rest of librealsense and can be theoretically moved into its own module.

Tracked on [LRS-891]

@maloel
maloel requested a review from Nir-Az October 1, 2023 16:49
Comment thread src/backend-device-factory.cpp Outdated
// backend-singleton will stay alive.
//
// We are responsible for exposing the single notification from the platform-device-watcher to several subscribers:
// one device-watcher, but many contexts, each with futher subscriptions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

further?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maloel
maloel merged commit 99c9420 into realsenseai:development Oct 3, 2023
@maloel
maloel deleted the singleton branch October 3, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants