Re: EINVAL error when call pthread_attr_setstacksize
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com 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 -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Jul 9, 2007, at 3:32 PM, Heidi Zhou wrote: 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. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert