From 3fc5ee5c2e4ed919b2939ca54a1958b8463eb404 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 May 2024 16:10:26 -0700 Subject: [PATCH] QThread/Doc: update the docs on setStackSize() There's some confusion about minimum and maximum. Pick-to: 6.7 Fixes: QTBUG-109512 Change-Id: I262c3499666e4f4fbcfbfffd17cc1d592bc658b3 Reviewed-by: Leena Miettinen Reviewed-by: Philip Van Hoof --- src/corelib/thread/qthread.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 8d8f353aaab..ea76a2ccada 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -531,10 +531,18 @@ bool QThread::isRunning() const } /*! - Sets the maximum stack size for the thread to \a stackSize. If \a - stackSize is greater than zero, the maximum stack size is set to - \a stackSize bytes, otherwise the maximum stack size is - automatically determined by the operating system. + Sets the stack size for the thread to \a stackSize. If \a stackSize is + zero, the operating system or runtime will choose a default value. + Otherwise, the thread's stack size will be the value provided (which may be + rounded up or down). + + On most operating systems, the amount of memory allocated to serve the + stack will initially be smaller than \a stackSize and will grow as the + thread uses the stack. This parameter sets the maximum size it will be + allowed to grow to (that is, it sets the size of the virtual memory space + the stack is allowed to occupy). + + This function can only be called before the thread is started. \warning Most operating systems place minimum and maximum limits on thread stack sizes. The thread will fail to start if the stack