Skip to content

Commit

Permalink
atomic_sync: Use the correct struct timespec on NetBSD for futex. (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
riastradh authored Jul 7, 2024
1 parent edd93ca commit c02621e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bee/thread/atomic_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ static void futex_wait(const int* ptr, int val, const FutexTimespec* timeout) {
# if defined(__linux__)
::syscall(SYS_futex, ptr, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, val, timeout, 0, 0);
# elif defined(__NetBSD__)
::syscall(SYS___futex, ptr, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, val, timeout, 0, 0, 0);
struct timespec ts;
ts.tv_sec = timeout->tv_sec;
ts.tv_nsec = timeout->tv_nsec;
::syscall(SYS___futex, ptr, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, val, &ts, 0, 0, 0);
# elif defined(__OpenBSD__)
static_assert(sizeof(FutexTimespec) == sizeof(timespec));
::futex((uint32_t*)const_cast<int*>(ptr), FUTEX_WAIT | FUTEX_PRIVATE_FLAG, val, (const timespec*)timeout, 0);
Expand Down

0 comments on commit c02621e

Please sign in to comment.