Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jun 2015 17:19:32 +0000
From:      Sebastian Kuzminsky <S.Kuzminsky@F5.com>
To:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Bug in FreeBSD 10.1's pthread barrier implementation?
Message-ID:  <D1973644.8FD0%seb@f5.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
I'm running in to a situation where pthread_barrier_t is not completely initialized, and later pthread_barrier_destroy() fails.

The attached patch (against FreeBSD 10.1) fixes the issue for me.

--
Sebastian Kuzminsky

[-- Attachment #2 --]
From c0af4905986fe28e54618e1ae60f4f7c7429f4d7 Mon Sep 17 00:00:00 2001
From: Sebastian Kuzminsky <seb@highlab.com>
Date: Fri, 5 Jun 2015 11:13:43 -0600
Subject: [PATCH] initialize pthread_barrier_t's b_destroying field

This internal state variable needs to be zeroed at init-time.

Signed-off-by: Sebastian Kuzminsky <seb@f5.com>
---
 lib/libthr/thread/thr_barrier.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libthr/thread/thr_barrier.c b/lib/libthr/thread/thr_barrier.c
index 86f880e..0aeb94b 100644
--- a/lib/libthr/thread/thr_barrier.c
+++ b/lib/libthr/thread/thr_barrier.c
@@ -96,6 +96,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier,
 	bar->b_waiters	= 0;
 	bar->b_count	= count;
 	bar->b_refcount = 0;
+	bar->b_destroying = 0;
 	*barrier	= bar;
 
 	return (0);
-- 
2.4.0


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D1973644.8FD0%seb>