]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Stack size is now specified at thread creation time.
authorBart Van Assche <bvanassche@acm.org>
Sat, 29 Mar 2008 09:28:12 +0000 (09:28 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 29 Mar 2008 09:28:12 +0000 (09:28 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7801

exp-drd/tests/matinv.c

index dd5f820e7f764dd2073fed4d9f7afa8c5a893d3c..7153beb09277310807b1c1bf383299f1ca2ff189 100644 (file)
@@ -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);