summaryrefslogtreecommitdiff
path: root/lib/librthread
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librthread')
-rw-r--r--lib/librthread/rthread_cond.c4
-rw-r--r--lib/librthread/rthread_mutex.c4
-rw-r--r--lib/librthread/rthread_rwlock.c5
-rw-r--r--lib/librthread/rthread_sync.c4
4 files changed, 13 insertions, 4 deletions
diff --git a/lib/librthread/rthread_cond.c b/lib/librthread/rthread_cond.c
index 3a484b04d06..184d533235f 100644
--- a/lib/librthread/rthread_cond.c
+++ b/lib/librthread/rthread_cond.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_cond.c,v 1.1 2017/05/27 14:20:39 mpi Exp $ */
+/* $OpenBSD: rthread_cond.c,v 1.2 2017/07/29 08:36:23 pirofti Exp $ */
/*
* Copyright (c) 2017 Martin Pieuchot <mpi@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -42,6 +42,8 @@ pthread_cond_init(pthread_cond_t *condp, const pthread_condattr_t *attr)
cond->clock = CLOCK_REALTIME;
else
cond->clock = (*attr)->ca_clock;
+
+ membar_producer();
*condp = cond;
return (0);
diff --git a/lib/librthread/rthread_mutex.c b/lib/librthread/rthread_mutex.c
index ea2db8131b3..cb4b2f0a0b0 100644
--- a/lib/librthread/rthread_mutex.c
+++ b/lib/librthread/rthread_mutex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_mutex.c,v 1.3 2017/05/29 14:47:54 mpi Exp $ */
+/* $OpenBSD: rthread_mutex.c,v 1.4 2017/07/29 08:36:23 pirofti Exp $ */
/*
* Copyright (c) 2017 Martin Pieuchot <mpi@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -64,6 +64,8 @@ pthread_mutex_init(pthread_mutex_t *mutexp, const pthread_mutexattr_t *attr)
mutex->prioceiling = (*attr)->ma_protocol ==
PTHREAD_PRIO_PROTECT ? (*attr)->ma_prioceiling : -1;
}
+
+ membar_producer();
*mutexp = mutex;
return (0);
diff --git a/lib/librthread/rthread_rwlock.c b/lib/librthread/rthread_rwlock.c
index 4faeb92372a..8bceba3b6a2 100644
--- a/lib/librthread/rthread_rwlock.c
+++ b/lib/librthread/rthread_rwlock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_rwlock.c,v 1.8 2016/09/04 10:13:35 akfaew Exp $ */
+/* $OpenBSD: rthread_rwlock.c,v 1.9 2017/07/29 08:36:23 pirofti Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -27,6 +27,8 @@
#include <pthread.h>
+#include <sys/atomic.h>
+
#include "rthread.h"
static _atomic_lock_t rwlock_init_lock = _SPINLOCK_UNLOCKED;
@@ -43,6 +45,7 @@ pthread_rwlock_init(pthread_rwlock_t *lockp,
lock->lock = _SPINLOCK_UNLOCKED;
TAILQ_INIT(&lock->writers);
+ membar_producer();
*lockp = lock;
return (0);
diff --git a/lib/librthread/rthread_sync.c b/lib/librthread/rthread_sync.c
index a9b490d5410..432469fa522 100644
--- a/lib/librthread/rthread_sync.c
+++ b/lib/librthread/rthread_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_sync.c,v 1.44 2016/09/04 10:13:35 akfaew Exp $ */
+/* $OpenBSD: rthread_sync.c,v 1.45 2017/07/29 08:36:23 pirofti Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -54,6 +54,8 @@ pthread_mutex_init(pthread_mutex_t *mutexp, const pthread_mutexattr_t *attr)
mutex->prioceiling = (*attr)->ma_protocol ==
PTHREAD_PRIO_PROTECT ? (*attr)->ma_prioceiling : -1;
}
+
+ membar_producer();
*mutexp = mutex;
return (0);