Minor improvements

This commit is contained in:
Maschell 2020-11-26 23:32:44 +01:00
parent 5a9aac7d22
commit bfb52bbeb5
4 changed files with 14 additions and 14 deletions

View File

@ -9,7 +9,7 @@
#include "ftp.h" #include "ftp.h"
#include "net.h" #include "net.h"
BackgroundThread * BackgroundThread::instance = NULL; BackgroundThread * BackgroundThread::instance = nullptr;
BackgroundThread::BackgroundThread(): BackgroundThreadWrapper(BackgroundThread::getPriority()) { BackgroundThread::BackgroundThread(): BackgroundThreadWrapper(BackgroundThread::getPriority()) {
DEBUG_FUNCTION_LINE("Create new Server"); DEBUG_FUNCTION_LINE("Create new Server");
@ -18,7 +18,7 @@ BackgroundThread::BackgroundThread(): BackgroundThreadWrapper(BackgroundThread::
DCFlushRange(&(this->serverSocket), 4); DCFlushRange(&(this->serverSocket), 4);
mutex.unlock(); mutex.unlock();
DEBUG_FUNCTION_LINE("handle %d", this->serverSocket); DEBUG_FUNCTION_LINE("handle %d", this->serverSocket);
resumeThread(); CThread::resumeThread();
} }
BackgroundThread::~BackgroundThread() { BackgroundThread::~BackgroundThread() {
@ -47,7 +47,7 @@ BOOL BackgroundThread::whileLoop() {
DCFlushRange(&(this->serverSocket), 4); DCFlushRange(&(this->serverSocket), 4);
mutex.unlock(); mutex.unlock();
} }
OSSleepTicks(OSMillisecondsToTicks(16));
} }
OSSleepTicks(OSMillisecondsToTicks(16));
return true; return true;
} }

View File

@ -60,6 +60,8 @@ ON_APPLICATION_START(args) {
ACGetAssignedAddress(&hostIpAddress); ACGetAssignedAddress(&hostIpAddress);
nn::ac::Finalize();
WHBLogUdpInit(); WHBLogUdpInit();
//!******************************************************************* //!*******************************************************************
@ -67,7 +69,7 @@ ON_APPLICATION_START(args) {
//!******************************************************************* //!*******************************************************************
DEBUG_FUNCTION_LINE("IOSUHAX_Open"); DEBUG_FUNCTION_LINE("IOSUHAX_Open");
int res = IOSUHAX_Open(NULL); int res = IOSUHAX_Open(nullptr);
if(res < 0) { if(res < 0) {
DEBUG_FUNCTION_LINE("IOSUHAX_open failed"); DEBUG_FUNCTION_LINE("IOSUHAX_open failed");
VirtualMountDevice("fs:/"); VirtualMountDevice("fs:/");

View File

@ -1,10 +1,8 @@
#include "BackgroundThreadWrapper.hpp" #include "BackgroundThreadWrapper.hpp"
#include <malloc.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <coreinit/cache.h> #include <coreinit/cache.h>
#include "logger.h"
BackgroundThreadWrapper::BackgroundThreadWrapper(int32_t priority): CThread(CThread::eAttributeAffCore2, priority, 0x100000) { BackgroundThreadWrapper::BackgroundThreadWrapper(int32_t priority): CThread(CThread::eAttributeAffCore2, priority, 0x100000) {
} }
@ -16,7 +14,7 @@ BackgroundThreadWrapper::~BackgroundThreadWrapper() {
} }
void BackgroundThreadWrapper::executeThread() { void BackgroundThreadWrapper::executeThread() {
while (1) { while (true) {
if(exitThread) { if(exitThread) {
DEBUG_FUNCTION_LINE("We want to exit"); DEBUG_FUNCTION_LINE("We want to exit");
break; break;

View File

@ -6,19 +6,19 @@
class BackgroundThreadWrapper: public CThread { class BackgroundThreadWrapper: public CThread {
public: public:
BackgroundThreadWrapper(int32_t priority); explicit BackgroundThreadWrapper(int32_t priority);
virtual ~BackgroundThreadWrapper(); ~BackgroundThreadWrapper() override;
protected: protected:
BOOL shouldExit() { [[nodiscard]] BOOL shouldExit() const {
return (exitThread == 1); return (exitThread == 1);
} }
void setThreadPriority(int32_t priority) { void setThreadPriority(int32_t priority) override {
this->setThreadPriority(priority); CThread::setThreadPriority(priority);
} }
std::recursive_mutex mutex; std::recursive_mutex mutex;
private: private:
void executeThread(); void executeThread() override;
/** /**
Called when a connection has be accepted. Called when a connection has be accepted.