From 925aa353bddfd9a1df7850e908df0addd2e10cec Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 12 Jan 2022 23:07:39 +0100 Subject: [PATCH] Avoid using the "new" operator to reduce the filesize --- source/CThread.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/CThread.h b/source/CThread.h index fa5929d..c3b41f0 100644 --- a/source/CThread.h +++ b/source/CThread.h @@ -52,10 +52,9 @@ public: static void runOnAllCores(CThread::Callback callback, void *callbackArg, int32_t iAttr = 0, int32_t iPriority = 16, int32_t iStackSize = 0x8000) { int32_t aff[] = {CThread::eAttributeAffCore2, CThread::eAttributeAffCore1, CThread::eAttributeAffCore0}; - for (int i : aff) { - CThread *thread = CThread::create(callback, callbackArg, iAttr | i, iPriority, iStackSize); - thread->resumeThread(); - delete thread; + for (int i: aff) { + CThread thread(iAttr | i, iPriority, iStackSize, callback, callbackArg); + thread.resumeThread(); } } @@ -111,7 +110,7 @@ public: } //! Shutdown thread - virtual void shutdownThread() { + void shutdownThread() { //! wait for thread to finish if (pThread && !(iAttributes & eAttributeDetach)) { while (isThreadSuspended()) {