Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
264996a7
Commit
264996a7
authored
Dec 27, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the futex system calls on all Linux platforms.
parent
0f9e93af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
critsection.c
dlls/ntdll/critsection.c
+12
-11
No files found.
dlls/ntdll/critsection.c
View file @
264996a7
...
...
@@ -26,6 +26,9 @@
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
#include <time.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
...
...
@@ -56,29 +59,27 @@ static inline void small_pause(void)
#endif
}
#if
defined(linux) && defined(__i386__)
#if
def __linux__
static
inline
int
futex_wait
(
int
*
addr
,
int
val
,
struct
timespec
*
timeout
)
{
int
ret
=
syscall
(
240
/*SYS_futex*/
,
addr
,
0
/*FUTEX_WAIT*/
,
val
,
timeout
,
0
,
0
);
if
(
ret
<
0
)
return
-
errno
;
return
ret
;
return
syscall
(
SYS_futex
,
addr
,
0
/*FUTEX_WAIT*/
,
val
,
timeout
,
0
,
0
);
}
static
inline
int
futex_wake
(
int
*
addr
,
int
val
)
{
int
ret
=
syscall
(
240
/*SYS_futex*/
,
addr
,
1
/*FUTEX_WAKE*/
,
val
,
NULL
,
0
,
0
);
if
(
ret
<
0
)
return
-
errno
;
return
ret
;
return
syscall
(
SYS_futex
,
addr
,
1
/*FUTEX_WAKE*/
,
val
,
NULL
,
0
,
0
);
}
static
inline
int
use_futexes
(
void
)
{
static
int
supported
=
-
1
;
if
(
supported
==
-
1
)
supported
=
(
futex_wait
(
&
supported
,
10
,
NULL
)
!=
-
ENOSYS
);
if
(
supported
==
-
1
)
{
futex_wait
(
&
supported
,
10
,
NULL
);
supported
=
(
errno
!=
ENOSYS
);
}
return
supported
;
}
...
...
@@ -95,7 +96,7 @@ static inline NTSTATUS fast_wait( RTL_CRITICAL_SECTION *crit, int timeout )
{
/* note: this may wait longer than specified in case of signals or */
/* multiple wake-ups, but that shouldn't be a problem */
if
(
futex_wait
(
(
int
*
)
&
crit
->
LockSemaphore
,
val
,
&
timespec
)
==
-
ETIMEDOUT
)
if
(
futex_wait
(
(
int
*
)
&
crit
->
LockSemaphore
,
val
,
&
timespec
)
==
-
1
&&
errno
==
ETIMEDOUT
)
return
STATUS_TIMEOUT
;
}
return
STATUS_WAIT_0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment