Skip to content

Commit

Permalink
openbsd: switch to libuv's barrier implementation
Browse files Browse the repository at this point in the history
On OpenBSD 6.4 x86_64 the barrier_serial_thread test fails due to
OpenBSD's pthread_barrier_wait() implementation returning
PTHREAD_BARRIER_SERIAL_THREAD from the first thread that releases the
wait. Switch to libuv's internal implementation to address the issue.

Fixes: libuv#2145
PR-URL: libuv#2144
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
ptlomholt authored and bnoordhuis committed Jan 16, 2019
1 parent f84c5e6 commit 176db21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/uv/unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ typedef pthread_cond_t uv_cond_t;
typedef pthread_key_t uv_key_t;

/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */
#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD)
#if defined(_AIX) || \
defined(__OpenBSD__) || \
!defined(PTHREAD_BARRIER_SERIAL_THREAD)
/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */
struct _uv_barrier {
uv_mutex_t mutex;
Expand Down
6 changes: 4 additions & 2 deletions src/unix/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
STATIC_ASSERT(sizeof(uv_barrier_t) == sizeof(pthread_barrier_t));
#endif

/* Note: guard clauses should match uv_barrier_t's in include/uv/uv-unix.h. */
#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD)
/* Note: guard clauses should match uv_barrier_t's in include/uv/unix.h. */
#if defined(_AIX) || \
defined(__OpenBSD__) || \
!defined(PTHREAD_BARRIER_SERIAL_THREAD)
int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
struct _uv_barrier* b;
int rc;
Expand Down

0 comments on commit 176db21

Please sign in to comment.