aboutsummaryrefslogtreecommitdiff
path: root/lib/thread.h
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-10-22 20:13:38 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-10-22 20:13:38 +0200
commit1121f5a8b93016992e122150ea3c867204ab407b (patch)
treeeea70053287689f266428fc9ed2c2e425079078b /lib/thread.h
parent3b4a6097dee760d22eecd97ebe041c69da6b056a (diff)
downloadmatcha-threads-1121f5a8b93016992e122150ea3c867204ab407b.tar.gz
matcha-threads-1121f5a8b93016992e122150ea3c867204ab407b.zip
fix memory leak when destroying Thread objectsfix-mem-leak-stack
Diffstat (limited to 'lib/thread.h')
-rw-r--r--lib/thread.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/thread.h b/lib/thread.h
index 3dfa457..4cae2e1 100644
--- a/lib/thread.h
+++ b/lib/thread.h
@@ -33,7 +33,7 @@ namespace nMatcha {
Thread(const Thread&) = delete;
Thread& operator=(const Thread&) = delete;
Thread();
- virtual ~Thread() {}
+ virtual ~Thread();
bool isFinished() const;
@@ -42,9 +42,13 @@ namespace nMatcha {
private:
virtual void threadFn() = 0;
-
static void entry(void* ctx);
- void* mStackPtr;
+
+ struct Stack {
+ void* mBottom;
+ size_t mSize;
+ void* mPtr;
+ } mStack;
bool mFinished;
friend struct Executor;