Print an error message instead of asserting when the count argument of pthread_barrier_init() is zero. Fixed a spelling error in an error message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8776 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c
index 542c610..fd4ecfa 100644
--- a/drd/drd_barrier.c
+++ b/drd/drd_barrier.c
@@ -99,7 +99,6 @@
{
tl_assert(barrier != 0);
tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier);
- tl_assert(count > 0);
tl_assert(p->a1 == barrier);
p->cleanup = (void(*)(DrdClientobj*))barrier_cleanup;
@@ -185,6 +184,16 @@
tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier);
+ if (count == 0)
+ {
+ BarrierErrInfo bei = { barrier };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ BarrierErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "pthread_barrier_init: 'count' argument is zero",
+ &bei);
+ }
+
if (! reinitialization && barrier_type == pthread_barrier)
{
p = barrier_get(barrier);
@@ -194,7 +203,7 @@
VG_(maybe_record_error)(VG_(get_running_tid)(),
BarrierErr,
VG_(get_IP)(VG_(get_running_tid)()),
- "Barrier reinitializatoin",
+ "Barrier reinitialization",
&bei);
}
}