aboutsummaryrefslogtreecommitdiffstats
path: root/main/mpd/stacksize.patch
blob: 26d6f78079c01675c5db721229a31e8e26f199c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/thread/Thread.cxx b/src/thread/Thread.cxx
index 2932d47..fd1f3ce 100644
--- a/src/thread/Thread.cxx
+++ b/src/thread/Thread.cxx
@@ -43,8 +43,12 @@ Thread::Start(void (*_f)(void *ctx), void *_ctx, Error &error)
 #ifndef NDEBUG
 	creating = true;
 #endif
-
-	int e = pthread_create(&handle, nullptr, ThreadProc, this);
+	pthread_attr_t attr, *attrptr = nullptr;
+	if ((pthread_attr_init(&attr) == 0)
+	    && (pthread_attr_setstacksize(&attr, 1024*1024) == 0)) {
+		attrptr = &attr;
+	}
+	int e = pthread_create(&handle, attrptr, ThreadProc, this);
 
 	if (e != 0) {
 #ifndef NDEBUG