fix: cleanly exit on shutdown (#5537)

Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Co-authored-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
pajlada
2024-08-10 14:24:25 +02:00
committed by GitHub
parent daff83dde8
commit 74d65a345d
23 changed files with 134 additions and 65 deletions
+5
View File
@@ -101,6 +101,11 @@ std::pair<std::unique_ptr<IpcQueue>, QString> IpcQueue::tryReplaceOrCreate(
}
}
bool IpcQueue::remove(const char *name)
{
return boost_ipc::message_queue::remove(name);
}
QByteArray IpcQueue::receive()
{
try
+2
View File
@@ -27,6 +27,8 @@ public:
static std::pair<std::unique_ptr<IpcQueue>, QString> tryReplaceOrCreate(
const char *name, size_t maxMessages, size_t maxMessageSize);
static bool remove(const char *name);
// TODO: use std::expected
/// Try to receive a message.
/// In the case of an error, the buffer is empty.
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <QString>
#include <QtGlobal>
#ifdef Q_OS_LINUX
# include <pthread.h>
#endif
namespace chatterino {
template <typename T>
void renameThread(T &&thread, const QString &threadName)
{
#ifdef Q_OS_LINUX
pthread_setname_np(thread.native_handle(), threadName.toLocal8Bit());
#endif
}
} // namespace chatterino