pthreads allows the user to provide a chunk of memory to use for a thread stack:
size_t stack_size = 1024*1024*4;
void *stack = malloc( stack_size );
pthread_attr_t attributes;
pthread_attr_init( &attributes );
pthread_attr_setstack( &attributes, stack, stack_size );
pthread_t thread_id;
pthread_create( &thread_id, &attributes, worker_function, NULL
Do Windows threads provide similar functionality? The second parameter to CreateThread allows one to specify the minimum size of the stack, but I can’t see a way to specify the address of a buffer to use.
You can not specify memory for stack as Jerry Coffin mention in comment, all you can specify is size of stack as second parameter to CreateThread call.
More info here.