|
From: <sv...@va...> - 2011-03-12 11:01:13
|
Author: bart
Date: 2011-03-12 11:01:06 +0000 (Sat, 12 Mar 2011)
New Revision: 11630
Log:
DRD: Allocate thread arguments again on the stack.
Modified:
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2011-03-12 10:37:18 UTC (rev 11629)
+++ trunk/drd/drd_pthread_intercepts.c 2011-03-12 11:01:06 UTC (rev 11630)
@@ -380,49 +380,36 @@
int res;
int ret;
OrigFn fn;
-#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
DrdPosixThreadArgs thread_args;
-#endif
- DrdPosixThreadArgs* thread_args_p;
VALGRIND_GET_ORIG_FN(fn);
-#if defined(ALLOCATE_THREAD_ARGS_ON_THE_STACK)
- thread_args_p = &thread_args;
-#else
- thread_args_p = malloc(sizeof(*thread_args_p));
-#endif
- assert(thread_args_p);
-
- thread_args_p->start = start;
- thread_args_p->arg = arg;
- DRD_IGNORE_VAR(thread_args_p->wrapper_started);
- thread_args_p->wrapper_started = 0;
+ thread_args.start = start;
+ thread_args.arg = arg;
+ DRD_IGNORE_VAR(thread_args.wrapper_started);
+ thread_args.wrapper_started = 0;
/*
* Find out whether the thread will be started as a joinable thread
* or as a detached thread. If no thread attributes have been specified,
* this means that the new thread will be started as a joinable thread.
*/
- thread_args_p->detachstate = PTHREAD_CREATE_JOINABLE;
+ thread_args.detachstate = PTHREAD_CREATE_JOINABLE;
if (attr)
{
- if (pthread_attr_getdetachstate(attr, &thread_args_p->detachstate) != 0)
- {
+ if (pthread_attr_getdetachstate(attr, &thread_args.detachstate) != 0)
assert(0);
- }
}
- assert(thread_args_p->detachstate == PTHREAD_CREATE_JOINABLE
- || thread_args_p->detachstate == PTHREAD_CREATE_DETACHED);
+ assert(thread_args.detachstate == PTHREAD_CREATE_JOINABLE
+ || thread_args.detachstate == PTHREAD_CREATE_DETACHED);
-
DRD_(entering_pthread_create)();
- CALL_FN_W_WWWW(ret, fn, thread, attr, DRD_(thread_wrapper), thread_args_p);
+ CALL_FN_W_WWWW(ret, fn, thread, attr, DRD_(thread_wrapper), &thread_args);
DRD_(left_pthread_create)();
if (ret == 0)
{
/* Wait until the thread wrapper started. */
- while (! thread_args_p->wrapper_started)
+ while (!thread_args.wrapper_started)
sched_yield();
}
|