|
From: <sv...@va...> - 2008-03-29 09:28:09
|
Author: bart
Date: 2008-03-29 09:28:12 +0000 (Sat, 29 Mar 2008)
New Revision: 7801
Log:
Stack size is now specified at thread creation time.
Modified:
trunk/exp-drd/tests/matinv.c
Modified: trunk/exp-drd/tests/matinv.c
===================================================================
--- trunk/exp-drd/tests/matinv.c 2008-03-29 09:27:08 UTC (rev 7800)
+++ trunk/exp-drd/tests/matinv.c 2008-03-29 09:28:12 UTC (rev 7801)
@@ -226,6 +226,8 @@
int i;
struct gj_threadinfo* t;
pthread_barrier_t b;
+ pthread_attr_t attr;
+ int err;
assert(rows <= cols);
@@ -233,6 +235,11 @@
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 @@
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);
|