From 03e0fe0a73ce2999f7c0156e6f233f0a577294af Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 9 Jun 2022 00:41:23 +0200 Subject: [PATCH] Add API to query Session event pool size --- libs/ardour/ardour/session_event.h | 1 + libs/ardour/session_events.cc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 417c8427d0..956495cb9e 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -148,6 +148,7 @@ public: static bool has_per_thread_pool (); static void create_per_thread_pool (const std::string& n, uint32_t nitems); static void init_event_pool (); + static guint pool_available (); CrossThreadPool* event_pool() const { return own_pool; } diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index d52c88e2bc..1225022175 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -43,6 +43,15 @@ SessionEvent::init_event_pool () pool = new PerThreadPool; } +guint +SessionEvent::pool_available () +{ + if (!pool || !pool->per_thread_pool (false)) { + return 0; + } + return pool->per_thread_pool()->available (); +} + bool SessionEvent::has_per_thread_pool () {