0001-Fix-for-running-under-MUSL-libc-e.g.-Alpine-Linux.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 830250759cd4c14ca2ae5ddf24f0a0427f258622 Mon Sep 17 00:00:00 2001
  2. From: Adam Ierymenko <adam.ierymenko@gmail.com>
  3. Date: Tue, 26 Jul 2016 16:36:20 -0700
  4. Subject: [PATCH 1/2] Fix for running under MUSL libc (e.g. Alpine Linux)
  5. ---
  6. osdep/Thread.hpp | 7 ++++++-
  7. 1 file changed, 6 insertions(+), 1 deletion(-)
  8. diff --git a/osdep/Thread.hpp b/osdep/Thread.hpp
  9. index 7fb38d8..4f90dc0 100644
  10. --- a/osdep/Thread.hpp
  11. +++ b/osdep/Thread.hpp
  12. @@ -125,6 +125,10 @@ public:
  13. throw()
  14. {
  15. memset(&_tid,0,sizeof(_tid));
  16. + pthread_attr_init(&_tattr);
  17. +#ifdef __LINUX__
  18. + pthread_attr_setstacksize(&_tattr,8388608); // for MUSL libc and others, has no effect in normal glibc environments
  19. +#endif
  20. _started = false;
  21. }
  22. @@ -157,7 +161,7 @@ public:
  23. {
  24. Thread t;
  25. t._started = true;
  26. - if (pthread_create(&t._tid,(const pthread_attr_t *)0,&___zt_threadMain<C>,instance))
  27. + if (pthread_create(&t._tid,&t._tattr,&___zt_threadMain<C>,instance))
  28. throw std::runtime_error("pthread_create() failed, unable to create thread");
  29. return t;
  30. }
  31. @@ -184,6 +188,7 @@ public:
  32. private:
  33. pthread_t _tid;
  34. + pthread_attr_t _tattr;
  35. volatile bool _started;
  36. };
  37. --
  38. 2.9.0