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:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user