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

View File

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

View File

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

View File

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