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