static int stack_min = sysconf(_SC_THREAD_STACK_MIN);
if (stack_min == -1)
stack_min = PTHREAD_STACK_MIN;
- if (Q_UNLIKELY(stackSize < stack_min)) {
+ // 0 means default stack size
+ if (Q_UNLIKELY(stackSize != 0 && stackSize < stack_min)) {
qWarning("QThread::setStackSize: %u is less than the minimum %u", stackSize, stack_min);
stackSize = stack_min;
}
void tst_QThread::setStackSize()
{
+#ifdef PTHREAD_STACK_MIN
+ static const uint stack_size = PTHREAD_STACK_MIN * 2;
+#else
+ static const uint stack_size = 16384; // default on Linux
+#endif
+
Simple_Thread thread;
QCOMPARE(thread.stackSize(), 0u);
- thread.setStackSize(8192u);
- QCOMPARE(thread.stackSize(), 8192u);
+ thread.setStackSize(stack_size);
+ QCOMPARE(thread.stackSize(), stack_size);
thread.setStackSize(0u);
QCOMPARE(thread.stackSize(), 0u);
}