This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/16299] pthread_attr_setstacksize ignored
- From: "knielson at adaptivecomputing dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 06 Dec 2013 21:10:04 +0000
- Subject: [Bug libc/16299] pthread_attr_setstacksize ignored
- Auto-submitted: auto-generated
- References: <bug-16299-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16299
--- Comment #2 from Ken Nielson <knielson at adaptivecomputing dot com> ---
Following is a sample of the code we are using. I have removed some of the
ancillary code to help make it easier to see how we are using the pthread
library.
#define MINIMUM_STACK_SIZE 16777216
#define MAX_STACK_SIZE MINIMUM_STACK_SIZE * 2
/*extern int LOGLEVEL;*/
sigset_t fillset;
threadpool_t *request_pool;
static void *work_thread(void *);
int create_work_thread(void)
{
int rc;
sigset_t oldset;
pthread_t wthread;
pthread_attr_t attr;
size_t stack_size;
char log_buf[LOG_BUF_SIZE];
if ((rc = pthread_attr_init(&attr)) != 0)
{
sprintf(log_buf, "pthread_attr_init failed. errno %d. Could not start
worker thread", errno);
perror(log_buf);
log_err(-1, __func__, log_buf);
return(PBSE_SYSTEM);
}
pthread_attr_getstacksize(&attr, &stack_size);
if (stack_size < MINIMUM_STACK_SIZE)
stack_size = MINIMUM_STACK_SIZE;
if (stack_size > MAX_STACK_SIZE)
stack_size = MAX_STACK_SIZE;
pthread_attr_setstacksize(&attr, stack_size);
/* save old signal mask */
pthread_sigmask(SIG_SETMASK,&fillset,&oldset);
rc = pthread_create(&wthread,&request_pool->tp_attr,work_thread, &attr);
pthread_sigmask(SIG_SETMASK,&oldset,NULL);
return(rc);
} /* END create_work_thread() */
--
You are receiving this mail because:
You are on the CC list for the bug.