|
From: <sv...@va...> - 2011-02-09 11:55:20
|
Author: bart
Date: 2011-02-09 11:55:12 +0000 (Wed, 09 Feb 2011)
New Revision: 11532
Log:
DRD: handle fork() in processes with detached threads correctly (see also #255355).
Modified:
trunk/drd/drd_thread.c
trunk/drd/drd_thread.h
Modified: trunk/drd/drd_thread.c
===================================================================
--- trunk/drd/drd_thread.c 2011-02-09 11:32:58 UTC (rev 11531)
+++ trunk/drd/drd_thread.c 2011-02-09 11:55:12 UTC (rev 11532)
@@ -367,7 +367,7 @@
DRD_(thread_get_stack_max)(drd_joinee));
}
DRD_(clientobj_delete_thread)(drd_joinee);
- DRD_(thread_delete)(drd_joinee);
+ DRD_(thread_delete)(drd_joinee, False);
}
/**
@@ -450,7 +450,7 @@
* Clean up thread-specific data structures. Call this just after
* pthread_join().
*/
-void DRD_(thread_delete)(const DrdThreadId tid)
+void DRD_(thread_delete)(const DrdThreadId tid, const Bool detached)
{
Segment* sg;
Segment* sg_prev;
@@ -467,7 +467,10 @@
}
DRD_(g_threadinfo)[tid].vg_thread_exists = False;
DRD_(g_threadinfo)[tid].posix_thread_exists = False;
- tl_assert(DRD_(g_threadinfo)[tid].detached_posix_thread == False);
+ if (detached)
+ DRD_(g_threadinfo)[tid].detached_posix_thread = False;
+ else
+ tl_assert(!DRD_(g_threadinfo)[tid].detached_posix_thread);
DRD_(g_threadinfo)[tid].first = 0;
DRD_(g_threadinfo)[tid].last = 0;
@@ -514,7 +517,7 @@
if (i == tid)
continue;
if (DRD_(IsValidDrdThreadId(i)))
- DRD_(thread_delete)(i);
+ DRD_(thread_delete)(i, True);
tl_assert(!DRD_(IsValidDrdThreadId(i)));
}
}
Modified: trunk/drd/drd_thread.h
===================================================================
--- trunk/drd/drd_thread.h 2011-02-09 11:32:58 UTC (rev 11531)
+++ trunk/drd/drd_thread.h 2011-02-09 11:55:12 UTC (rev 11532)
@@ -134,7 +134,7 @@
const ThreadId vg_created);
DrdThreadId DRD_(thread_post_create)(const ThreadId vg_created);
void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee);
-void DRD_(thread_delete)(const DrdThreadId tid);
+void DRD_(thread_delete)(const DrdThreadId tid, Bool detached);
void DRD_(thread_finished)(const DrdThreadId tid);
void DRD_(drd_thread_atfork_child)(const DrdThreadId tid);
void DRD_(thread_pre_cancel)(const DrdThreadId tid);
|