From ce0461bf86ff82962dd4f13c436b98ac1fe1a4a7 Mon Sep 17 00:00:00 2001 From: r4sas Date: Tue, 12 Nov 2024 21:09:21 +0000 Subject: [PATCH] Destination: cut name for thread name Signed-off-by: r4sas --- libi2pd/util.cpp | 10 +++++++++- libi2pd/util.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index d1ed9992..47cecbbe 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2023, The PurpleI2P Project +* Copyright (c) 2013-2024, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -171,6 +171,14 @@ namespace util } } + void RunnableService::SetName (std::string_view name) + { + if (name.length() < 16) + m_Name = name; + else + m_Name = name.substr(0,15); + } + void SetThreadName (const char *name) { #if defined(__APPLE__) # if (!defined(MAC_OS_X_VERSION_10_6) || \ diff --git a/libi2pd/util.h b/libi2pd/util.h index cb636aaa..48bcb801 100644 --- a/libi2pd/util.h +++ b/libi2pd/util.h @@ -183,7 +183,7 @@ namespace util void StartIOService (); void StopIOService (); - void SetName (std::string_view name) { m_Name = name; }; + void SetName (std::string_view name); private: