|
From: <sv...@va...> - 2008-06-28 11:52:54
|
Author: bart
Date: 2008-06-28 12:53:01 +0100 (Sat, 28 Jun 2008)
New Revision: 8294
Log:
Delayed thread termination such that the "other segment" information is included in the data race reports.
Modified:
trunk/exp-drd/tests/rwlock_race.c
trunk/exp-drd/tests/rwlock_race.stderr.exp
Modified: trunk/exp-drd/tests/rwlock_race.c
===================================================================
--- trunk/exp-drd/tests/rwlock_race.c 2008-06-28 10:00:37 UTC (rev 8293)
+++ trunk/exp-drd/tests/rwlock_race.c 2008-06-28 11:53:01 UTC (rev 8294)
@@ -8,19 +8,27 @@
#define _GNU_SOURCE 1
+#include <pthread.h>
#include <stdio.h>
-#include <pthread.h>
+#include <unistd.h>
#include "../drd_clientreq.h"
static pthread_rwlock_t s_rwlock;
static int s_racy;
-static void* thread(void* arg)
+static void sleep_ms(const int ms)
{
+ struct timespec delay = { ms / 1000, (ms % 1000) * 1000 * 1000 };
+ nanosleep(&delay, 0);
+}
+
+static void* thread_func(void* arg)
+{
pthread_rwlock_rdlock(&s_rwlock);
s_racy++;
pthread_rwlock_unlock(&s_rwlock);
+ sleep_ms(100);
return 0;
}
@@ -36,8 +44,8 @@
#endif
pthread_rwlock_init(&s_rwlock, 0);
- pthread_create(&thread1, 0, thread, 0);
- pthread_create(&thread2, 0, thread, 0);
+ pthread_create(&thread1, 0, thread_func, 0);
+ pthread_create(&thread2, 0, thread_func, 0);
pthread_join(thread1, 0);
pthread_join(thread2, 0);
pthread_rwlock_destroy(&s_rwlock);
Modified: trunk/exp-drd/tests/rwlock_race.stderr.exp
===================================================================
--- trunk/exp-drd/tests/rwlock_race.stderr.exp 2008-06-28 10:00:37 UTC (rev 8293)
+++ trunk/exp-drd/tests/rwlock_race.stderr.exp 2008-06-28 11:53:01 UTC (rev 8294)
@@ -1,28 +1,44 @@
-Thread 2:
-Conflicting load by thread 2/3 at 0x........ size 4
- at 0x........: thread (rwlock_race.c:?)
+Thread 3:
+Conflicting load by thread 3/3 at 0x........ size 4
+ at 0x........: thread_func (rwlock_race.c:?)
by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
by 0x........: (within libpthread-?.?.so)
by 0x........: clone (in /...libc...)
Location 0x........ is 0 bytes inside local var "s_racy"
-declared at rwlock_race.c:17, in frame #? of thread 2
-Other segment start (thread 0/2)
- (thread finished, call stack no longer available)
-Other segment end (thread 0/2)
- (thread finished, call stack no longer available)
+declared at rwlock_race.c:18, in frame #? of thread 3
+Other segment start (thread 2/2)
+ at 0x........: pthread_rwlock_rdlock* (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (rwlock_race.c:?)
+ by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
+ by 0x........: (within libpthread-?.?.so)
+ by 0x........: clone (in /...libc...)
+Other segment end (thread 2/2)
+ at 0x........: pthread_rwlock_unlock* (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (rwlock_race.c:?)
+ by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
+ by 0x........: (within libpthread-?.?.so)
+ by 0x........: clone (in /...libc...)
-Conflicting store by thread 2/3 at 0x........ size 4
- at 0x........: thread (rwlock_race.c:?)
+Conflicting store by thread 3/3 at 0x........ size 4
+ at 0x........: thread_func (rwlock_race.c:?)
by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
by 0x........: (within libpthread-?.?.so)
by 0x........: clone (in /...libc...)
Location 0x........ is 0 bytes inside local var "s_racy"
-declared at rwlock_race.c:17, in frame #? of thread 2
-Other segment start (thread 0/2)
- (thread finished, call stack no longer available)
-Other segment end (thread 0/2)
- (thread finished, call stack no longer available)
+declared at rwlock_race.c:18, in frame #? of thread 3
+Other segment start (thread 2/2)
+ at 0x........: pthread_rwlock_rdlock* (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (rwlock_race.c:?)
+ by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
+ by 0x........: (within libpthread-?.?.so)
+ by 0x........: clone (in /...libc...)
+Other segment end (thread 2/2)
+ at 0x........: pthread_rwlock_unlock* (drd_pthread_intercepts.c:?)
+ by 0x........: thread_func (rwlock_race.c:?)
+ by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
+ by 0x........: (within libpthread-?.?.so)
+ by 0x........: clone (in /...libc...)
Result: 2
ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
|