From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20761 invoked by alias); 6 Dec 2013 21:10:09 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 20676 invoked by uid 48); 6 Dec 2013 21:10:05 -0000 From: "knielson at adaptivecomputing dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/16299] pthread_attr_setstacksize ignored Date: Fri, 06 Dec 2013 21:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.18 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: knielson at adaptivecomputing dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00090.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16299 --- Comment #2 from Ken Nielson --- 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.