+
+void ls::details::locked_session_release(ltt_session *session)
+{
+ session_unlock(session);
+ session_put(session);
+}
+
+ltt_session::locked_ptr ls::find_locked_session_by_id(ltt_session::id_t id)
+{
+ lttng::urcu::read_lock_guard rcu_lock;
+ auto session = session_find_by_id(id);
+
+ if (!session) {
+ return nullptr;
+ }
+
+ /*
+ * The pointer falling out of scope will unlock and release the reference to the
+ * session.
+ */
+ session_lock(session);
+ return ltt_session::locked_ptr(session);
+}
+
+ltt_session::sptr ls::find_session_by_id(ltt_session::id_t id)
+{
+ lttng::urcu::read_lock_guard rcu_lock;
+ auto session = session_find_by_id(id);
+
+ if (!session) {
+ return nullptr;
+ }
+
+ return { session, session_put };
+}