From: Bart Van Assche Date: Sat, 29 Mar 2008 09:28:12 +0000 (+0000) Subject: Stack size is now specified at thread creation time. X-Git-Tag: svn/VALGRIND_3_4_0~787 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f79df6ea814d7a9cc286c188b25ff0907801ae1;p=thirdparty%2Fvalgrind.git Stack size is now specified at thread creation time. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7801 --- diff --git a/exp-drd/tests/matinv.c b/exp-drd/tests/matinv.c index dd5f820e7f..7153beb092 100644 --- a/exp-drd/tests/matinv.c +++ b/exp-drd/tests/matinv.c @@ -226,6 +226,8 @@ static void gj(elem_t* const a, const int rows, const int cols) int i; struct gj_threadinfo* t; pthread_barrier_t b; + pthread_attr_t attr; + int err; assert(rows <= cols); @@ -233,6 +235,11 @@ static void gj(elem_t* const a, const int rows, const int cols) pthread_barrier_init(&b, 0, s_nthread); + pthread_attr_init(&attr); + /* To do: replace the stack size argument by PTHREAD_STACK_MIN + 4096. */ + err = pthread_attr_setstacksize(&attr, 32768); + assert(err == 0); + for (i = 0; i < s_nthread; i++) { t[i].b = &b; @@ -241,9 +248,11 @@ static void gj(elem_t* const a, const int rows, const int cols) t[i].cols = cols; t[i].r0 = i * rows / s_nthread; t[i].r1 = (i+1) * rows / s_nthread; - pthread_create(&t[i].tid, 0, (void*(*)(void*))gj_threadfunc, &t[i]); + pthread_create(&t[i].tid, &attr, (void*(*)(void*))gj_threadfunc, &t[i]); } + pthread_attr_destroy(&attr); + for (i = 0; i < s_nthread; i++) { pthread_join(t[i].tid, 0);