Date: Sun, 10 Apr 2005 23:49:22 GMT From: Bill Middleton <flashdict@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: i386/79772: Setting thread stacksize to PTHREAD_STACK_MIN disables thread creation Message-ID: <200504102349.j3ANnMEJ031857@www.freebsd.org> Resent-Message-ID: <200504102350.j3ANoMwn060608@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 79772 >Category: i386 >Synopsis: Setting thread stacksize to PTHREAD_STACK_MIN disables thread creation >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Apr 10 23:50:21 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Bill Middleton >Release: 6.0-CURRENT >Organization: >Environment: FreeBSD myhostname.com 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Wed Apr 6 02:41:00 CEST 2005 flashdict@gmail.com:/u2/freebsd/src/sys/i386/compile/MYKERNEL i386 >Description: Setting stacksize to PTHREAD_STACK_MIN disables new thread creation with EAGAIN and strerror: Resource temporarily unavailable This when linked against libthr or libpthread. libc_r works ok. >How-To-Repeat: Compile the following C program and link against each of the three libs. void thread_main (void *arg) { sleep (10); } int main () { static pthread_t t1,t2; static pthread_attr_t attr; int ret; size_t mysize; ret = pthread_attr_init (&attr); ret = pthread_attr_getstacksize (&attr, &mysize); printf("Current stacksize is %d\n",mysize); printf("Starting a new thread\n"); pthread_create (&t1, &attr, thread_main, NULL); if(ret == 0) printf("Thread created ok\n"); printf("Setting stacksize to PTHREAD_STACK_MIN: %d\n",PTHREAD_STACK_MIN); ret = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); if(ret == 0) printf("Stacksize changed ok\n"); else printf("Couldn't set stacksize: %s",strerror (ret)); ret = pthread_attr_getstacksize (&attr, &mysize); printf("New stacksize is %d\n",mysize); printf("Starting another new thread\n"); ret = pthread_create (&t2, &attr, thread_main, NULL); if(ret == 0) printf("Thread created ok\n"); else printf("Couldn't create thread: %s\n",strerror (ret)); } >Fix: Heh. I wish. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504102349.j3ANnMEJ031857>