From d85dcb0be236dcba1fd3ae6fdc2de3b8a08cde6b Mon Sep 17 00:00:00 2001 From: Darek Date: Tue, 13 Oct 2026 04:39:33 +0200 Subject: [PATCH] docs(main): pin ClientContext::interrupt() as async-signal-safe The Python driver calls ClientContext::interrupt() from its SIGINT handler, which is only valid while the function is a single lock-free atomic store. State that contract on the function and static_assert that the atomic is always lock-free. No behaviour change. Co-Authored-By: Claude Opus 5.5 --- src/include/main/client_context.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/include/main/client_context.h b/src/include/main/client_context.h index 6ed109f8b..0f0bdeb72 100644 --- a/src/include/main/client_context.h +++ b/src/include/main/client_context.h @@ -96,6 +96,9 @@ class LBUG_API ClientContext { common::Value getCurrentSetting(const std::string& optionName) const; // Timer and timeout + // Async-signal-safe: the Python driver calls this from its SIGINT handler, so it must stay a + // single lock-free atomic store, with no locks, allocation or exceptions. + static_assert(decltype(ActiveQuery::interrupted)::is_always_lock_free); void interrupt() { activeQuery.interrupted = true; } bool interrupted() const { return activeQuery.interrupted; } void setActiveQueryID(uint64_t queryID) { activeQuery.queryID = queryID; }