> Is it possible to set the stack size for the thread created by
> BackgroundWorker like in the API call _beginthread?
No.
> If not is the stack size a default or the one I set for the whole
> application?
The latter. See here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_co
re_.2f.stack_linker.asp
for the linker option
and here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_co
re_STACKSIZE.asp
for the equivalent module definition file option. Note that either only has
a bearing on executables.
Regards.
Will
William DePalo [MVP VC++] - 01 Jun 2005 19:54 GMT
>> Is it possible to set the stack size for the thread created by
>> BackgroundWorker like in the API call _beginthread?
>
> No.
I may have misinterpreted your question. The question I _thought_ you were
asking is "Is it possible to set the stack size for threads I create at
runtime?". The answer to that question for native applications is no as I
wrote. The total size of the address space to be occupied by the stack is
set a link time. The parameter passed to beginthreadex() is just the subset
of that region which is initially committed. The stack will grow dynamically
from its initially committed size to the size reserved at link time.
If, though, BackgroundWorker refers to some thread class which I don't see
the MSDN index, then please post again with more details as to the class.
Regards,
Will
> Is it possible to set the stack size for the thread created by
> BackgroundWorker like in the API call _beginthread? If not is the stack
[quoted text clipped - 6 lines]
> Cheers
> Jürgen
Background worker (Framework v2.0) uses a default stack size of 1MB and
there is no way to change it, but the Thread class has a contructor overload
that takes the stack size as argument.
public:
Thread(
ThreadStart^ start,
int maxStackSize
);Willy.
Marcus Heege - 02 Jun 2005 21:43 GMT
Backgroundworker uses the CLR thread pool. In theory it is possible to
influence theads in the CLR thread pool using the custom CLR hosting APIs,
but you will rearely want to do this.
>> Is it possible to set the stack size for the thread created by
>> BackgroundWorker like in the API call _beginthread? If not is the stack
[quoted text clipped - 16 lines]
> int maxStackSize
> );Willy.
Willy Denoyette [MVP] - 03 Jun 2005 00:02 GMT
> Backgroundworker uses the CLR thread pool. In theory it is possible to
> influence theads in the CLR thread pool using the custom CLR hosting APIs,
> but you will rearely want to do this.
I don't see any possibility to change the stack size of the CLR threadpool
threads using the hosting API's.
Only thing that can be done is setting the stacksize for tasks attributed to
fibers in v2.0. I'm I missing something?
Willy.