Re: EINVAL error when call pthread_attr_setstacksize
Re: EINVAL error when call pthread_attr_setstacksize
- Subject: Re: EINVAL error when call pthread_attr_setstacksize
- From: Terry Lambert <email@hidden>
- Date: Mon, 9 Jul 2007 17:06:05 -0700
On Jul 9, 2007, at 3:32 PM, Heidi Zhou wrote:
Hello!
I am trying to set thread stack size attribute. My
code is
stacksize = (PTHREAD_STACK_MIN);
res = pthread_attr_setstacksize(&tattr, stacksize);
if(res != 0) {
printf("Failed to set thread stack size due to:
%s\n", strerror(res));
return false;
}
However, I always got EINVAL error. I read the man
page and some posts on the mailing list and knew that
the stack size has to be a multiple of 4KB (4096). I
tried but I just always got EINVAL error.
Here is my system information
8.10.1 Darwin Kernel Version 8.10.1: Wed May 23
16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386
i386 i386
Any idea why?
At a guess, you are declaring a static instance of a thread attribute,
and assuming it is initialized by default, which it isn't.
You must call pthread_attr_init() before calling
pthread_attr_setstacksize() or any other attribute changes.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden