summaryrefslogtreecommitdiff
path: root/osdep/Thread.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/Thread.hpp')
-rw-r--r--osdep/Thread.hpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/osdep/Thread.hpp b/osdep/Thread.hpp
index 4f90dc0b..9f6fb5a8 100644
--- a/osdep/Thread.hpp
+++ b/osdep/Thread.hpp
@@ -126,12 +126,17 @@ public:
{
memset(&_tid,0,sizeof(_tid));
pthread_attr_init(&_tattr);
-#ifdef __LINUX__
- pthread_attr_setstacksize(&_tattr,8388608); // for MUSL libc and others, has no effect in normal glibc environments
-#endif
+ // This corrects for systems with abnormally small defaults (musl) and also
+ // shrinks the stack on systems with large defaults to save a bit of memory.
+ pthread_attr_setstacksize(&_tattr,524288);
_started = false;
}
+ ~Thread()
+ {
+ pthread_attr_destroy(&_tattr);
+ }
+
Thread(const Thread &t)
throw()
{