Re: [Mesa-dev] [PATCH] util/futex: use futex syscall on OpenBSD

2019-12-02 Thread Marek Olšák
Pushed. Thanks!

Marek

On Sat, Nov 30, 2019 at 10:19 AM Jonathan Gray  wrote:

> Make use of the futex syscall added in OpenBSD 6.2.
>
> Signed-off-by: Jonathan Gray 
> ---
>  src/util/futex.h | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/util/futex.h b/src/util/futex.h
> index 268af92882a..cf8dd0206c9 100644
> --- a/src/util/futex.h
> +++ b/src/util/futex.h
> @@ -85,6 +85,24 @@ static inline int futex_wait(uint32_t *addr, int32_t
> value, struct timespec *tim
> return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr,
> uaddr2) == -1 ? errno : 0;
>  }
>
> +#elif defined(__OpenBSD__)
> +
> +#include 
> +#include 
> +
> +static inline int futex_wake(uint32_t *addr, int count)
> +{
> +   return futex(addr, FUTEX_WAKE, count, NULL, NULL);
> +}
> +
> +static inline int futex_wait(uint32_t *addr, int32_t value, const struct
> timespec *timeout)
> +{
> +   struct timespec tsrel, tsnow;
> +   clock_gettime(CLOCK_MONOTONIC, );
> +   timespecsub(timeout, , );
> +   return futex(addr, FUTEX_WAIT, value, , NULL);
> +}
> +
>  #endif
>
>  #endif /* UTIL_FUTEX_H */
> --
> 2.24.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] util/futex: use futex syscall on OpenBSD

2019-11-30 Thread Jonathan Gray
Make use of the futex syscall added in OpenBSD 6.2.

Signed-off-by: Jonathan Gray 
---
 src/util/futex.h | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/src/util/futex.h b/src/util/futex.h
index 268af92882a..cf8dd0206c9 100644
--- a/src/util/futex.h
+++ b/src/util/futex.h
@@ -85,6 +85,24 @@ static inline int futex_wait(uint32_t *addr, int32_t value, 
struct timespec *tim
return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == 
-1 ? errno : 0;
 }
 
+#elif defined(__OpenBSD__)
+
+#include 
+#include 
+
+static inline int futex_wake(uint32_t *addr, int count)
+{
+   return futex(addr, FUTEX_WAKE, count, NULL, NULL);
+}
+
+static inline int futex_wait(uint32_t *addr, int32_t value, const struct 
timespec *timeout)
+{
+   struct timespec tsrel, tsnow;
+   clock_gettime(CLOCK_MONOTONIC, ); 
+   timespecsub(timeout, , );
+   return futex(addr, FUTEX_WAIT, value, , NULL);
+}
+
 #endif
 
 #endif /* UTIL_FUTEX_H */
-- 
2.24.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev