Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
aef2e017
Commit
aef2e017
authored
Jan 15, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Jan 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Move interlocked functions to winnt.h.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0762f672
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
132 deletions
+132
-132
winbase.h
include/winbase.h
+0
-132
winnt.h
include/winnt.h
+132
-0
No files found.
include/winbase.h
View file @
aef2e017
...
...
@@ -2919,138 +2919,6 @@ extern char * CDECL wine_get_unix_file_name( LPCWSTR dos );
extern
WCHAR
*
CDECL
wine_get_dos_file_name
(
LPCSTR
str
);
/* Interlocked functions */
#ifdef _MSC_VER
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedCompareExchange64)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
long
_InterlockedCompareExchange
(
long
volatile
*
,
long
,
long
);
long
long
_InterlockedCompareExchange64
(
long
long
volatile
*
,
long
long
,
long
long
);
long
_InterlockedDecrement
(
long
volatile
*
);
long
_InterlockedExchange
(
long
volatile
*
,
long
);
long
_InterlockedExchangeAdd
(
long
volatile
*
,
long
);
long
_InterlockedIncrement
(
long
volatile
*
);
static
FORCEINLINE
LONG
WINAPI
InterlockedCompareExchange
(
LONG
volatile
*
dest
,
LONG
xchg
,
LONG
compare
)
{
return
_InterlockedCompareExchange
(
(
long
volatile
*
)
dest
,
xchg
,
compare
);
}
static
FORCEINLINE
LONGLONG
WINAPI
InterlockedCompareExchange64
(
LONGLONG
volatile
*
dest
,
LONGLONG
xchg
,
LONGLONG
compare
)
{
return
_InterlockedCompareExchange64
(
(
long
long
volatile
*
)
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchange
(
LONG
volatile
*
dest
,
LONG
val
)
{
return
_InterlockedExchange
(
(
long
volatile
*
)
dest
,
val
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchangeAdd
(
LONG
volatile
*
dest
,
LONG
incr
)
{
return
_InterlockedExchangeAdd
(
(
long
volatile
*
)
dest
,
incr
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedIncrement
(
LONG
volatile
*
dest
)
{
return
_InterlockedIncrement
(
(
long
volatile
*
)
dest
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedDecrement
(
LONG
volatile
*
dest
)
{
return
_InterlockedDecrement
(
(
long
volatile
*
)
dest
);
}
#ifndef __i386__
#pragma intrinsic(_InterlockedCompareExchangePointer)
#pragma intrinsic(_InterlockedExchangePointer)
#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
#define InterlockedExchangePointer _InterlockedExchangePointer
void
*
InterlockedCompareExchangePointer
(
void
*
volatile
*
,
void
*
,
void
*
);
void
*
InterlockedExchangePointer
(
void
*
volatile
*
,
void
*
);
#else
static
FORCEINLINE
void
*
WINAPI
InterlockedCompareExchangePointer
(
void
*
volatile
*
dest
,
void
*
xchg
,
void
*
compare
)
{
return
(
void
*
)
_InterlockedCompareExchange
(
(
long
volatile
*
)
dest
,
(
long
)
xchg
,
(
long
)
compare
);
}
static
FORCEINLINE
void
*
WINAPI
InterlockedExchangePointer
(
void
*
volatile
*
dest
,
void
*
val
)
{
return
(
void
*
)
_InterlockedExchange
(
(
long
volatile
*
)
dest
,
(
long
)
val
);
}
#endif
#elif defined(__GNUC__)
static
FORCEINLINE
LONG
WINAPI
InterlockedCompareExchange
(
LONG
volatile
*
dest
,
LONG
xchg
,
LONG
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
PVOID
WINAPI
InterlockedCompareExchangePointer
(
PVOID
volatile
*
dest
,
PVOID
xchg
,
PVOID
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
LONGLONG
WINAPI
InterlockedCompareExchange64
(
LONGLONG
volatile
*
dest
,
LONGLONG
xchg
,
LONGLONG
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchange
(
LONG
volatile
*
dest
,
LONG
val
)
{
LONG
ret
;
#if defined(__i386__) || defined(__x86_64__)
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#else
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
#endif
return
ret
;
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchangeAdd
(
LONG
volatile
*
dest
,
LONG
incr
)
{
return
__sync_fetch_and_add
(
dest
,
incr
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedIncrement
(
LONG
volatile
*
dest
)
{
return
__sync_add_and_fetch
(
dest
,
1
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedDecrement
(
LONG
volatile
*
dest
)
{
return
__sync_add_and_fetch
(
dest
,
-
1
);
}
static
FORCEINLINE
PVOID
WINAPI
InterlockedExchangePointer
(
PVOID
volatile
*
dest
,
PVOID
val
)
{
PVOID
ret
;
#ifdef __x86_64__
__asm__
__volatile__
(
"lock; xchgq %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#elif defined(__i386__)
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#else
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
#endif
return
ret
;
}
#endif
/* __GNUC__ */
#ifdef __WINESRC__
static
FORCEINLINE
HANDLE
WINAPI
GetCurrentProcess
(
void
)
...
...
include/winnt.h
View file @
aef2e017
...
...
@@ -6892,6 +6892,138 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask)
#endif
/* Interlocked functions */
#ifdef _MSC_VER
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedCompareExchange64)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
long
_InterlockedCompareExchange
(
long
volatile
*
,
long
,
long
);
long
long
_InterlockedCompareExchange64
(
long
long
volatile
*
,
long
long
,
long
long
);
long
_InterlockedDecrement
(
long
volatile
*
);
long
_InterlockedExchange
(
long
volatile
*
,
long
);
long
_InterlockedExchangeAdd
(
long
volatile
*
,
long
);
long
_InterlockedIncrement
(
long
volatile
*
);
static
FORCEINLINE
LONG
WINAPI
InterlockedCompareExchange
(
LONG
volatile
*
dest
,
LONG
xchg
,
LONG
compare
)
{
return
_InterlockedCompareExchange
(
(
long
volatile
*
)
dest
,
xchg
,
compare
);
}
static
FORCEINLINE
LONGLONG
WINAPI
InterlockedCompareExchange64
(
LONGLONG
volatile
*
dest
,
LONGLONG
xchg
,
LONGLONG
compare
)
{
return
_InterlockedCompareExchange64
(
(
long
long
volatile
*
)
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchange
(
LONG
volatile
*
dest
,
LONG
val
)
{
return
_InterlockedExchange
(
(
long
volatile
*
)
dest
,
val
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchangeAdd
(
LONG
volatile
*
dest
,
LONG
incr
)
{
return
_InterlockedExchangeAdd
(
(
long
volatile
*
)
dest
,
incr
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedIncrement
(
LONG
volatile
*
dest
)
{
return
_InterlockedIncrement
(
(
long
volatile
*
)
dest
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedDecrement
(
LONG
volatile
*
dest
)
{
return
_InterlockedDecrement
(
(
long
volatile
*
)
dest
);
}
#ifndef __i386__
#pragma intrinsic(_InterlockedCompareExchangePointer)
#pragma intrinsic(_InterlockedExchangePointer)
#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
#define InterlockedExchangePointer _InterlockedExchangePointer
void
*
InterlockedCompareExchangePointer
(
void
*
volatile
*
,
void
*
,
void
*
);
void
*
InterlockedExchangePointer
(
void
*
volatile
*
,
void
*
);
#else
static
FORCEINLINE
void
*
WINAPI
InterlockedCompareExchangePointer
(
void
*
volatile
*
dest
,
void
*
xchg
,
void
*
compare
)
{
return
(
void
*
)
_InterlockedCompareExchange
(
(
long
volatile
*
)
dest
,
(
long
)
xchg
,
(
long
)
compare
);
}
static
FORCEINLINE
void
*
WINAPI
InterlockedExchangePointer
(
void
*
volatile
*
dest
,
void
*
val
)
{
return
(
void
*
)
_InterlockedExchange
(
(
long
volatile
*
)
dest
,
(
long
)
val
);
}
#endif
#elif defined(__GNUC__)
static
FORCEINLINE
LONG
WINAPI
InterlockedCompareExchange
(
LONG
volatile
*
dest
,
LONG
xchg
,
LONG
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
void
*
WINAPI
InterlockedCompareExchangePointer
(
void
*
volatile
*
dest
,
void
*
xchg
,
void
*
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
LONGLONG
WINAPI
InterlockedCompareExchange64
(
LONGLONG
volatile
*
dest
,
LONGLONG
xchg
,
LONGLONG
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchange
(
LONG
volatile
*
dest
,
LONG
val
)
{
LONG
ret
;
#if defined(__i386__) || defined(__x86_64__)
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#else
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
#endif
return
ret
;
}
static
FORCEINLINE
LONG
WINAPI
InterlockedExchangeAdd
(
LONG
volatile
*
dest
,
LONG
incr
)
{
return
__sync_fetch_and_add
(
dest
,
incr
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedIncrement
(
LONG
volatile
*
dest
)
{
return
__sync_add_and_fetch
(
dest
,
1
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedDecrement
(
LONG
volatile
*
dest
)
{
return
__sync_add_and_fetch
(
dest
,
-
1
);
}
static
FORCEINLINE
void
*
WINAPI
InterlockedExchangePointer
(
void
*
volatile
*
dest
,
void
*
val
)
{
void
*
ret
;
#ifdef __x86_64__
__asm__
__volatile__
(
"lock; xchgq %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#elif defined(__i386__)
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#else
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
#endif
return
ret
;
}
#endif
/* __GNUC__ */
#ifdef _WIN64
#if defined(_MSC_VER)
...
...
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