Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7649a1ad4c | ||
|
|
3fd46cbbbc | ||
|
|
d99001d6eb |
@@ -11,15 +11,13 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build-ppc:
|
build-ppc:
|
||||||
name: "🔨 Build for PowerPC"
|
name: "🔨 Build for PowerPC"
|
||||||
runs-on: msi-walmart
|
runs-on: asrock
|
||||||
container:
|
container:
|
||||||
image: git.tesses.org/tesses50/linux-ppc:latest
|
image: git.tesses.org/tesses50/linux-ppc:latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: bash build-for-ppc.sh
|
- run: bash build-for-ppc.sh
|
||||||
- uses: akkuman/gitea-release-action@v1
|
- uses: akkuman/gitea-release-action@v1
|
||||||
env:
|
|
||||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
|
||||||
with:
|
with:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: |-
|
files: |-
|
||||||
@@ -36,8 +34,6 @@ jobs:
|
|||||||
env -C Packaging/WinToolsIntel bash build.sh
|
env -C Packaging/WinToolsIntel bash build.sh
|
||||||
|
|
||||||
- uses: akkuman/gitea-release-action@v1
|
- uses: akkuman/gitea-release-action@v1
|
||||||
env:
|
|
||||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
|
||||||
with:
|
with:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: |-
|
files: |-
|
||||||
@@ -60,15 +56,15 @@ jobs:
|
|||||||
build-packages:
|
build-packages:
|
||||||
name: "🔨 Build for everything else"
|
name: "🔨 Build for everything else"
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- container: "git.tesses.org/tesses50/linux-x64:latest"
|
- container: "git.tesses.org/tesses50/linux-x64:latest"
|
||||||
puter: "msi-walmart"
|
puter: "asrock"
|
||||||
nfpmName: "amd64"
|
nfpmName: "amd64"
|
||||||
debianName: "x86_64-linux-gnu"
|
debianName: "x86_64-linux-gnu"
|
||||||
- container: "git.tesses.org/tesses50/linux-x86:latest"
|
- container: "git.tesses.org/tesses50/linux-x86:latest"
|
||||||
puter: "asrock"
|
puter: "msi-walmart"
|
||||||
nfpmName: "386"
|
nfpmName: "386"
|
||||||
debianName: "i386-linux-gnu"
|
debianName: "i386-linux-gnu"
|
||||||
- container: "git.tesses.org/tesses50/linux-arm:latest"
|
- container: "git.tesses.org/tesses50/linux-arm:latest"
|
||||||
@@ -82,17 +78,14 @@ jobs:
|
|||||||
- container: "git.tesses.org/tesses50/linux-riscv64:latest"
|
- container: "git.tesses.org/tesses50/linux-riscv64:latest"
|
||||||
nfpmName: "riscv64"
|
nfpmName: "riscv64"
|
||||||
debianName: "riscv64-linux-gnu"
|
debianName: "riscv64-linux-gnu"
|
||||||
puter: "asrock"
|
puter: "msi-walmart"
|
||||||
runs-on: ${{ matrix.puter }}
|
runs-on: ${{ matrix.puter }}
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.container }}
|
image: ${{ matrix.container }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
url: https://git.tesses.org/tesses50/tessesframework.git
|
|
||||||
- run: bash build-for-nfpm.sh ${{ matrix.nfpmName }} ${{ matrix.debianName }}
|
- run: bash build-for-nfpm.sh ${{ matrix.nfpmName }} ${{ matrix.debianName }}
|
||||||
- uses: akkuman/gitea-release-action@v1
|
- uses: akkuman/gitea-release-action@v1
|
||||||
env:
|
|
||||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
|
||||||
with:
|
with:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: |-
|
files: |-
|
||||||
|
|||||||
+4
-1
@@ -1,7 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.0.11
|
||||||
|
Fix the event loop so it isn't 100% CPU utilization
|
||||||
|
|
||||||
## 0.0.10
|
## 0.0.10
|
||||||
Fix NX, add constant time compare, add TF_Span
|
Fix NX, add constant time compare
|
||||||
|
|
||||||
## 0.0.9
|
## 0.0.9
|
||||||
Make html parser use case insensitive unordered_map for attributes
|
Make html parser use case insensitive unordered_map for attributes
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
set(TESSESFRAMEWORK_MAJOR_VERSION 0)
|
set(TESSESFRAMEWORK_MAJOR_VERSION 0)
|
||||||
set(TESSESFRAMEWORK_MINOR_VERSION 0)
|
set(TESSESFRAMEWORK_MINOR_VERSION 0)
|
||||||
set(TESSESFRAMEWORK_PATCH_VERSION 10)
|
set(TESSESFRAMEWORK_PATCH_VERSION 11)
|
||||||
|
|||||||
@@ -40,66 +40,7 @@
|
|||||||
|
|
||||||
namespace Tesses::Framework {
|
namespace Tesses::Framework {
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class TF_Span {
|
|
||||||
public:
|
|
||||||
using value_type = T;
|
|
||||||
using pointer = T*;
|
|
||||||
using const_pointer = const T*;
|
|
||||||
using reference = T&;
|
|
||||||
using const_reference = const T&;
|
|
||||||
using size_type = std::size_t;
|
|
||||||
constexpr TF_Span(pointer data, size_type size) : data_(data), size_(size) {}
|
|
||||||
template <std::size_t N>
|
|
||||||
constexpr TF_Span(T (&arr)[N]) : data_(arr), size_(N) {}
|
|
||||||
template <typename Container>
|
|
||||||
constexpr TF_Span(const Container& container) : data_(container.data()), size_(container.size()) {
|
|
||||||
static_assert(std::is_same<typename Container::value_type, T>::value,"Container value_type must match Span's type");
|
|
||||||
}
|
|
||||||
reference operator[](size_type index) {
|
|
||||||
return data_[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reference operator[](size_type index) const {
|
|
||||||
return data_[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
const_reference at(size_type index) const {
|
|
||||||
if (index >= size_) {
|
|
||||||
throw std::out_of_range("Index out of range");
|
|
||||||
}
|
|
||||||
return data_[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data and size
|
|
||||||
pointer data() noexcept { return data_; }
|
|
||||||
const_pointer data() const noexcept { return data_; }
|
|
||||||
|
|
||||||
size_type size() const noexcept { return size_; }
|
|
||||||
bool empty() const noexcept { return size_ == 0; }
|
|
||||||
|
|
||||||
// Iterators
|
|
||||||
pointer begin() noexcept { return data_; }
|
|
||||||
pointer end() noexcept { return data_ + size_; }
|
|
||||||
|
|
||||||
const_pointer begin() const noexcept { return data_; }
|
|
||||||
const_pointer end() const noexcept { return data_ + size_; }
|
|
||||||
TF_Span subspan(size_type offset, size_type count = static_cast<size_type>(-1)) const {
|
|
||||||
if (offset > size_) {
|
|
||||||
throw std::out_of_range("Offset out of range");
|
|
||||||
}
|
|
||||||
count = (count == static_cast<size_type>(-1)) ? (size_ - offset) : count;
|
|
||||||
if (count > size_ - offset) {
|
|
||||||
throw std::out_of_range("Count exceeds remaining elements");
|
|
||||||
}
|
|
||||||
return TF_Span(data_ + offset, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
pointer data_;
|
|
||||||
size_type size_;
|
|
||||||
};
|
|
||||||
class TF_Timer_Handle;
|
class TF_Timer_Handle;
|
||||||
// Used for internal purposes, don't use unless you want to run timer events on
|
// Used for internal purposes, don't use unless you want to run timer events on
|
||||||
// another thread
|
// another thread
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ typedef enum {
|
|||||||
bool PBKDF2(std::vector<uint8_t> &output, std::string pass,
|
bool PBKDF2(std::vector<uint8_t> &output, std::string pass,
|
||||||
std::vector<uint8_t> &salt, long itterations, ShaVersion version);
|
std::vector<uint8_t> &salt, long itterations, ShaVersion version);
|
||||||
|
|
||||||
bool ConstantEquals(const TF_Span<uint8_t> left, const TF_Span<uint8_t> right);
|
bool ConstantEquals(const std::vector<uint8_t>& left, const std::vector<uint8_t>& right);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get secure random bytes
|
* @brief Get secure random bytes
|
||||||
|
|||||||
@@ -80,15 +80,7 @@ class NetworkStream : public Stream {
|
|||||||
size_t ReadFrom(uint8_t *buff, size_t sz, std::string &ip, uint16_t &port);
|
size_t ReadFrom(uint8_t *buff, size_t sz, std::string &ip, uint16_t &port);
|
||||||
size_t WriteTo(const uint8_t *buff, size_t sz, std::string ip,
|
size_t WriteTo(const uint8_t *buff, size_t sz, std::string ip,
|
||||||
uint16_t port);
|
uint16_t port);
|
||||||
size_t ReadFrom(TF_Span<uint8_t> buff, std::string &ip, uint16_t &port)
|
|
||||||
{
|
|
||||||
return ReadFrom(buff.data(),buff.size(),ip, port);
|
|
||||||
}
|
|
||||||
size_t WriteTo(const TF_Span<uint8_t> buff, std::string ip,
|
|
||||||
uint16_t port)
|
|
||||||
{
|
|
||||||
return WriteTo(buff.data(),buff.size(),ip, port);
|
|
||||||
}
|
|
||||||
static std::vector<std::pair<std::string, std::string>>
|
static std::vector<std::pair<std::string, std::string>>
|
||||||
GetIPs(bool ipV6 = false);
|
GetIPs(bool ipV6 = false);
|
||||||
|
|
||||||
|
|||||||
@@ -35,22 +35,6 @@ class Stream {
|
|||||||
virtual size_t Write(const uint8_t *buff, size_t sz);
|
virtual size_t Write(const uint8_t *buff, size_t sz);
|
||||||
size_t ReadBlock(uint8_t *buff, size_t sz);
|
size_t ReadBlock(uint8_t *buff, size_t sz);
|
||||||
void WriteBlock(const uint8_t *buff, size_t sz);
|
void WriteBlock(const uint8_t *buff, size_t sz);
|
||||||
size_t Read(TF_Span<uint8_t> buff) {
|
|
||||||
return Read(buff.data(), buff.size());
|
|
||||||
}
|
|
||||||
size_t Write(const TF_Span<uint8_t> buff)
|
|
||||||
{
|
|
||||||
return Write(buff.data(), buff.size());
|
|
||||||
}
|
|
||||||
size_t ReadBlock(TF_Span<uint8_t> buff)
|
|
||||||
{
|
|
||||||
return ReadBlock(buff.data(), buff.size());
|
|
||||||
}
|
|
||||||
void WriteBlock(const TF_Span<uint8_t> buff)
|
|
||||||
{
|
|
||||||
WriteBlock(buff.data(),buff.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanRead();
|
virtual bool CanRead();
|
||||||
virtual bool CanWrite();
|
virtual bool CanWrite();
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ bool RandomBytes(std::vector<uint8_t> &output, std::string personal_str) {
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ConstantEquals(const TF_Span<uint8_t> left, const TF_Span<uint8_t> right)
|
bool ConstantEquals(const std::vector<uint8_t>& left, const std::vector<uint8_t>& right)
|
||||||
{
|
{
|
||||||
if (left.size() != right.size()) return false;
|
if (left.size() != right.size()) return false;
|
||||||
if (left.empty()) return true;
|
if (left.empty()) return true;
|
||||||
|
|||||||
@@ -282,13 +282,23 @@ FIFOCreationResult LocalFilesystem::CreateFIFO(VFSPath path, uint32_t mod) {
|
|||||||
void LocalFilesystem::Lock(VFSPath path) {
|
void LocalFilesystem::Lock(VFSPath path) {
|
||||||
auto p2 = VFSPathToSystem(path);
|
auto p2 = VFSPathToSystem(path);
|
||||||
const char *fopenPath = p2.c_str();
|
const char *fopenPath = p2.c_str();
|
||||||
while (true) {
|
for (int i = 0; i < 10; i++) {
|
||||||
FILE *fp = fopen(fopenPath, "wx");
|
FILE *fp = fopen(fopenPath, "wx");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errno != EEXIST) {
|
||||||
|
std::string error_msg("Failed to acquire lock on ");
|
||||||
|
error_msg += p2;
|
||||||
|
error_msg += ": ";
|
||||||
|
error_msg += strerror(errno);
|
||||||
|
throw std::runtime_error(error_msg);
|
||||||
|
}
|
||||||
|
TF_Sleep(100);
|
||||||
}
|
}
|
||||||
|
throw std::runtime_error("Lock acquisition timed out for " + p2);
|
||||||
}
|
}
|
||||||
void LocalFilesystem::Unlock(VFSPath path) {
|
void LocalFilesystem::Unlock(VFSPath path) {
|
||||||
std::error_code error;
|
std::error_code error;
|
||||||
|
|||||||
+2
-14
@@ -98,13 +98,7 @@ static GXRModeObj *rmode = NULL;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Tesses::Framework {
|
namespace Tesses::Framework {
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_THREADING) && \
|
|
||||||
(defined(GEKKO) || defined(__SWITCH__))
|
|
||||||
namespace Threading {
|
|
||||||
extern void JoinAllThreads();
|
|
||||||
extern void LookForFinishedThreads();
|
|
||||||
} // namespace Threading
|
|
||||||
#endif
|
|
||||||
volatile static bool isRunningSig = true;
|
volatile static bool isRunningSig = true;
|
||||||
volatile static std::atomic<bool> isRunning;
|
volatile static std::atomic<bool> isRunning;
|
||||||
volatile static std::atomic<bool> gaming_console_events = true;
|
volatile static std::atomic<bool> gaming_console_events = true;
|
||||||
@@ -268,10 +262,6 @@ int64_t TF_Timer_Handle::GetIntervalMilliseconds() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TF_RunEventLoopItteration() {
|
void TF_RunEventLoopItteration() {
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_THREADING) && (defined(__SWITCH__))
|
|
||||||
Tesses::Framework::Threading::LookForFinishedThreads();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_THREADING)
|
#if defined(TESSESFRAMEWORK_ENABLE_THREADING)
|
||||||
invokings_mtx.Lock();
|
invokings_mtx.Lock();
|
||||||
auto invokes = invokings;
|
auto invokes = invokings;
|
||||||
@@ -315,13 +305,11 @@ void TF_RunEventLoopItteration() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
timer_handler->Update();
|
timer_handler->Update();
|
||||||
|
TF_Sleep(1);
|
||||||
}
|
}
|
||||||
void TF_SetIsRunning(bool _isRunning) { isRunning = _isRunning; }
|
void TF_SetIsRunning(bool _isRunning) { isRunning = _isRunning; }
|
||||||
void TF_Quit() {
|
void TF_Quit() {
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_THREADING) && (defined(__SWITCH__))
|
|
||||||
Tesses::Framework::Threading::JoinAllThreads();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
void TF_InitEventLoop() {
|
void TF_InitEventLoop() {
|
||||||
signal(SIGINT, _sigInt);
|
signal(SIGINT, _sigInt);
|
||||||
|
|||||||
+2
-102
@@ -40,89 +40,6 @@ namespace Tesses::Framework::Threading {
|
|||||||
|
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_THREADING)
|
#if defined(TESSESFRAMEWORK_ENABLE_THREADING)
|
||||||
|
|
||||||
#if defined(__SWITCH__)
|
|
||||||
Mutex needed_to_be_joined_mtx;
|
|
||||||
class NeedToBeJoinnedThread {
|
|
||||||
|
|
||||||
static void *cb(void *data) {
|
|
||||||
|
|
||||||
auto ntbjt = static_cast<NeedToBeJoinnedThread *>(data);
|
|
||||||
|
|
||||||
ntbjt->hasInvoked = true;
|
|
||||||
TF_LOG("About to call thread func");
|
|
||||||
if (ntbjt->_cb)
|
|
||||||
ntbjt->_cb();
|
|
||||||
TF_LOG("Finished calling thread func");
|
|
||||||
ntbjt->hasExited = true;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
std::function<void()> _cb;
|
|
||||||
std::atomic<bool> hasInvoked = false;
|
|
||||||
|
|
||||||
pthread_t thrd;
|
|
||||||
|
|
||||||
public:
|
|
||||||
NeedToBeJoinnedThread(std::function<void()> cb) {
|
|
||||||
this->_cb = cb;
|
|
||||||
joinned = false;
|
|
||||||
joinning = false;
|
|
||||||
hasExited = false;
|
|
||||||
|
|
||||||
pthread_create(&thrd, NULL, this->cb, static_cast<void *>(this));
|
|
||||||
}
|
|
||||||
std::atomic<bool> joinned;
|
|
||||||
std::atomic<bool> joinning;
|
|
||||||
std::atomic<bool> hasExited;
|
|
||||||
void Join();
|
|
||||||
void WaitTillInvoked() {
|
|
||||||
while (!hasInvoked)
|
|
||||||
;
|
|
||||||
TF_LOG("Invoked!");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void NeedToBeJoinnedThread::Join() {
|
|
||||||
if (joinning) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
joinning = true;
|
|
||||||
pthread_join(this->thrd, NULL);
|
|
||||||
|
|
||||||
joinned = true;
|
|
||||||
// start the joinning process
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<NeedToBeJoinnedThread>> needToBeJoinnedThread;
|
|
||||||
void JoinAllThreads() {
|
|
||||||
needed_to_be_joined_mtx.Lock();
|
|
||||||
for (auto item : needToBeJoinnedThread) {
|
|
||||||
item->Join();
|
|
||||||
}
|
|
||||||
needToBeJoinnedThread.clear();
|
|
||||||
needed_to_be_joined_mtx.Unlock();
|
|
||||||
}
|
|
||||||
void LookForFinishedThreads() {
|
|
||||||
|
|
||||||
needed_to_be_joined_mtx.Lock();
|
|
||||||
for (auto index = needToBeJoinnedThread.begin();
|
|
||||||
index < needToBeJoinnedThread.end(); index++) {
|
|
||||||
auto &idx = *index;
|
|
||||||
if (idx->hasExited) {
|
|
||||||
if (idx->joinning)
|
|
||||||
while (!idx->joinned)
|
|
||||||
;
|
|
||||||
TF_LOG("ABOUT TO JOIN");
|
|
||||||
idx->Join();
|
|
||||||
TF_LOG("JOINNED");
|
|
||||||
needToBeJoinnedThread.erase(index);
|
|
||||||
index--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
needed_to_be_joined_mtx.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
class ThreadHiddenFieldData : public HiddenFieldData {
|
class ThreadHiddenFieldData : public HiddenFieldData {
|
||||||
public:
|
public:
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -130,8 +47,7 @@ class ThreadHiddenFieldData : public HiddenFieldData {
|
|||||||
HANDLE thrd;
|
HANDLE thrd;
|
||||||
DWORD thrdId;
|
DWORD thrdId;
|
||||||
|
|
||||||
#elif defined(__SWITCH__)
|
|
||||||
std::shared_ptr<NeedToBeJoinnedThread> thread;
|
|
||||||
#else
|
#else
|
||||||
pthread_t thrd;
|
pthread_t thrd;
|
||||||
#endif
|
#endif
|
||||||
@@ -143,8 +59,6 @@ class ThreadHiddenFieldData : public HiddenFieldData {
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static DWORD __stdcall cb(LPVOID data)
|
static DWORD __stdcall cb(LPVOID data)
|
||||||
#elif defined(__SWITCH__)
|
|
||||||
static void cb(void *data)
|
|
||||||
#else
|
#else
|
||||||
static void *cb(void *data)
|
static void *cb(void *data)
|
||||||
#endif
|
#endif
|
||||||
@@ -154,10 +68,8 @@ static void *cb(void *data)
|
|||||||
auto fn = thrd->fn;
|
auto fn = thrd->fn;
|
||||||
thrd->hasInvoked = true;
|
thrd->hasInvoked = true;
|
||||||
fn();
|
fn();
|
||||||
#if !defined(_WIN32) && !defined(__SWITCH__)
|
#if !defined(_WIN32)
|
||||||
return NULL;
|
return NULL;
|
||||||
#elif (__SWITCH__)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -174,9 +86,6 @@ Thread::Thread(std::function<void()> fn) {
|
|||||||
CreateThread(NULL, 0, cb, static_cast<LPVOID>(data), 0, &data->thrdId);
|
CreateThread(NULL, 0, cb, static_cast<LPVOID>(data), 0, &data->thrdId);
|
||||||
while (!data->hasInvoked)
|
while (!data->hasInvoked)
|
||||||
;
|
;
|
||||||
#elif defined(__SWITCH__)
|
|
||||||
data->thread = std::make_shared<NeedToBeJoinnedThread>(fn);
|
|
||||||
data->thread->WaitTillInvoked();
|
|
||||||
// threadCreate(,cb,static_cast<void*>(data),NULL,8000000,0x00,-2);
|
// threadCreate(,cb,static_cast<void*>(data),NULL,8000000,0x00,-2);
|
||||||
#else
|
#else
|
||||||
pthread_create(&data->thrd, NULL, cb, static_cast<void *>(data));
|
pthread_create(&data->thrd, NULL, cb, static_cast<void *>(data));
|
||||||
@@ -193,13 +102,6 @@ void Thread::Detach() {
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
CloseHandle(data->thrd);
|
CloseHandle(data->thrd);
|
||||||
#elif defined(__SWITCH__)
|
|
||||||
TF_LOG("Detaching");
|
|
||||||
needed_to_be_joined_mtx.Lock();
|
|
||||||
needToBeJoinnedThread.push_back(data->thread);
|
|
||||||
needed_to_be_joined_mtx.Unlock();
|
|
||||||
|
|
||||||
TF_LOG("Detached!");
|
|
||||||
#else
|
#else
|
||||||
pthread_detach(data->thrd);
|
pthread_detach(data->thrd);
|
||||||
#endif
|
#endif
|
||||||
@@ -212,8 +114,6 @@ void Thread::Join() {
|
|||||||
auto data = this->data.GetField<ThreadHiddenFieldData *>();
|
auto data = this->data.GetField<ThreadHiddenFieldData *>();
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
WaitForSingleObject(data->thrd, INFINITE);
|
WaitForSingleObject(data->thrd, INFINITE);
|
||||||
#elif defined(__SWITCH__)
|
|
||||||
data->thread->Join();
|
|
||||||
#else
|
#else
|
||||||
pthread_join(data->thrd, NULL);
|
pthread_join(data->thrd, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user