refactor: XMT Classes => MTException Classes

This commit is contained in:
sithlord48 2025-08-07 16:57:23 -04:00 committed by Nick Bolton
parent ada2813f9f
commit 22a358fb49
4 changed files with 15 additions and 13 deletions

View file

@ -8,12 +8,12 @@ add_library(mt STATIC
CondVar.h CondVar.h
Lock.cpp Lock.cpp
Lock.h Lock.h
MTException.cpp
MTException.h
Mutex.cpp Mutex.cpp
Mutex.h Mutex.h
Thread.cpp Thread.cpp
Thread.h Thread.h
XMT.cpp
XMT.h
XThread.h XThread.h
) )

View file

@ -1,17 +1,18 @@
/* /*
* 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
*/ */
#include "XMT.h" #include "MTException.h"
// //
// XMTThreadUnavailable // MTThreadUnavailableException
// //
std::string XMTThreadUnavailable::getWhat() const throw() std::string MTThreadUnavailableException::getWhat() const throw()
{ {
return format("XMTThreadUnavailable", "cannot create thread"); return format("MTThreadUnavailableException", "cannot create thread");
} }

View file

@ -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
@ -10,19 +11,19 @@
#include "base/XBase.h" #include "base/XBase.h"
/** /**
* @brief XMT generic multithreading exception * @brief MTException generic multithreading exception
*/ */
class XMT : public XBase class MTException : public XBase
{ {
using XBase::XBase; using XBase::XBase;
}; };
/** /**
* @brief XMTThreadUnavailable - Thrown when a thread cannot be created. * @brief MTThreadUnavailableException - Thrown when a thread cannot be created.
*/ */
class XMTThreadUnavailable : public XMT class MTThreadUnavailableException : public MTException
{ {
using XMT::XMT; using MTException::MTException;
protected: protected:
std::string getWhat() const throw() override; std::string getWhat() const throw() override;

View file

@ -10,7 +10,7 @@
#include "arch/Arch.h" #include "arch/Arch.h"
#include "base/IJob.h" #include "base/IJob.h"
#include "base/Log.h" #include "base/Log.h"
#include "mt/XMT.h" #include "mt/MTException.h"
#include "mt/XThread.h" #include "mt/XThread.h"
#include <exception> #include <exception>
@ -24,7 +24,7 @@ Thread::Thread(IJob *job)
if (m_thread == nullptr) { if (m_thread == nullptr) {
// couldn't create thread // couldn't create thread
delete job; delete job;
throw XMTThreadUnavailable(); throw MTThreadUnavailableException();
} }
} }