Maarten Lankhorst : ntdll: Use FUTEX_PRIVATE_FLAG for critical section futexes when available.
Alexandre Julliard
julliard at winehq.org
Thu Aug 4 12:22:09 CDT 2011
Module: wine
Branch: master
Commit: 57493fdd8c76e9ec3f621be8aaf4e04d9d0ade9c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=57493fdd8c76e9ec3f621be8aaf4e04d9d0ade9c
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Wed Aug 3 20:27:43 2011 +0200
ntdll: Use FUTEX_PRIVATE_FLAG for critical section futexes when available.
---
dlls/ntdll/critsection.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index 2f1abcf..fb69b31 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -61,14 +61,17 @@ static inline void small_pause(void)
#ifdef __linux__
+static int wait_op = 128; /*FUTEX_WAIT|FUTEX_PRIVATE_FLAG*/
+static int wake_op = 129; /*FUTEX_WAKE|FUTEX_PRIVATE_FLAG*/
+
static inline int futex_wait( int *addr, int val, struct timespec *timeout )
{
- return syscall( SYS_futex, addr, 0/*FUTEX_WAIT*/, val, timeout, 0, 0 );
+ return syscall( SYS_futex, addr, wait_op, val, timeout, 0, 0 );
}
static inline int futex_wake( int *addr, int val )
{
- return syscall( SYS_futex, addr, 1/*FUTEX_WAKE*/, val, NULL, 0, 0 );
+ return syscall( SYS_futex, addr, wake_op, val, NULL, 0, 0 );
}
static inline int use_futexes(void)
@@ -78,6 +81,12 @@ static inline int use_futexes(void)
if (supported == -1)
{
futex_wait( &supported, 10, NULL );
+ if (errno == ENOSYS)
+ {
+ wait_op = 0; /*FUTEX_WAIT*/
+ wake_op = 1; /*FUTEX_WAKE*/
+ futex_wait( &supported, 10, NULL );
+ }
supported = (errno != ENOSYS);
}
return supported;
More information about the wine-cvs
mailing list