refactor: mt/XThread Classes => mt/ThreadException Classes
This commit is contained in:
@ -14,7 +14,7 @@ add_library(mt STATIC
|
||||
Mutex.h
|
||||
Thread.cpp
|
||||
Thread.h
|
||||
XThread.h
|
||||
ThreadException.h
|
||||
)
|
||||
|
||||
target_link_libraries(mt PUBLIC base)
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "base/IJob.h"
|
||||
#include "base/Log.h"
|
||||
#include "mt/MTException.h"
|
||||
#include "mt/XThread.h"
|
||||
#include "mt/ThreadException.h"
|
||||
#include <exception>
|
||||
|
||||
//
|
||||
@ -57,7 +57,7 @@ Thread &Thread::operator=(const Thread &thread)
|
||||
|
||||
[[noreturn]] void Thread::exit(void *result)
|
||||
{
|
||||
throw XThreadExit(result);
|
||||
throw ThreadExitException(result);
|
||||
}
|
||||
|
||||
void Thread::cancel()
|
||||
@ -133,7 +133,7 @@ void *Thread::threadFunc(void *vjob)
|
||||
LOG_DEBUG1("caught cancel on thread 0x%08x", id);
|
||||
delete job;
|
||||
throw;
|
||||
} catch (XThreadExit &e) {
|
||||
} catch (ThreadExitException &e) {
|
||||
// client called exit()
|
||||
result = e.m_result;
|
||||
LOG_DEBUG1("caught exit on thread 0x%08x, result %p", id, result);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
|
||||
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
||||
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
@ -13,17 +14,17 @@
|
||||
/*!
|
||||
Thrown by Thread::exit() to exit a thread. Clients of Thread
|
||||
must not throw this type but must rethrow it if caught (by
|
||||
XThreadExit, XThread, or ...).
|
||||
ThreadExitException, XThread, or ...).
|
||||
*/
|
||||
class XThreadExit : public XThread
|
||||
class ThreadExitException : public XThread
|
||||
{
|
||||
public:
|
||||
//! \c result is the result of the thread
|
||||
explicit XThreadExit(void *result) : m_result(result)
|
||||
explicit ThreadExitException(void *result) : m_result(result)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
~XThreadExit() override = default;
|
||||
~ThreadExitException() override = default;
|
||||
|
||||
public:
|
||||
void *m_result;
|
||||
Reference in New Issue
Block a user