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
e994d503
Commit
e994d503
authored
Aug 09, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Interlocked*Pointer functions.
Fixed InterlockedCompareExchange prototype.
parent
da920ee9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
18 deletions
+41
-18
main.c
dlls/ddraw/dsurface/main.c
+4
-4
critsection.c
dlls/ntdll/critsection.c
+2
-2
socket.c
dlls/winsock/socket.c
+1
-1
x11drv_main.c
dlls/x11drv/x11drv_main.c
+4
-4
winbase.h
include/winbase.h
+27
-4
critsection.c
scheduler/critsection.c
+1
-1
pthread.c
scheduler/pthread.c
+2
-2
No files found.
dlls/ddraw/dsurface/main.c
View file @
e994d503
...
...
@@ -315,10 +315,10 @@ Main_DirectDrawSurface_ChangeUniquenessValue(LPDIRECTDRAWSURFACE7 iface)
if
(
old_uniqueness_value
==
0
)
break
;
if
(
new_uniqueness_value
==
0
)
new_uniqueness_value
=
1
;
if
(
InterlockedCompareExchange
((
PVOID
*
)
&
vThis
->
uniqueness_value
,
(
PVOID
)
old_uniqueness_value
,
(
PVOID
)
new_uniqueness_value
)
==
(
PVOID
)
old_uniqueness_value
)
if
(
InterlockedCompareExchange
((
LONG
*
)
&
vThis
->
uniqueness_value
,
old_uniqueness_value
,
new_uniqueness_value
)
==
old_uniqueness_value
)
break
;
}
...
...
dlls/ntdll/critsection.c
View file @
e994d503
...
...
@@ -127,8 +127,8 @@ static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit )
{
HANDLE
sem
;
if
(
NtCreateSemaphore
(
&
sem
,
SEMAPHORE_ALL_ACCESS
,
NULL
,
0
,
1
))
return
0
;
if
(
!
(
ret
=
(
HANDLE
)
InterlockedCompareExchange
(
(
PVOID
*
)
&
crit
->
LockSemaphore
,
(
PVOID
)
sem
,
0
)))
if
(
!
(
ret
=
(
HANDLE
)
interlocked_cmpxchg
(
(
PVOID
*
)
&
crit
->
LockSemaphore
,
(
PVOID
)
sem
,
0
)))
ret
=
sem
;
else
NtClose
(
sem
);
/* somebody beat us to it */
...
...
dlls/winsock/socket.c
View file @
e994d503
...
...
@@ -736,7 +736,7 @@ static void WSOCK32_async_accept(SOCKET s, SOCKET as)
int
q
;
/* queue socket for WSAAsyncSelect */
for
(
q
=
0
;
q
<
WS_ACCEPT_QUEUE
;
q
++
)
if
(
InterlockedCompareExchange
((
PVOID
*
)
&
accept_old
[
q
],
(
PVOID
)
s
,
(
PVOID
)
0
)
==
(
PVOID
)
0
)
if
(
InterlockedCompareExchange
((
LONG
*
)
&
accept_old
[
q
],
s
,
0
)
==
0
)
break
;
if
(
q
<
WS_ACCEPT_QUEUE
)
accept_new
[
q
]
=
as
;
...
...
dlls/x11drv/x11drv_main.c
View file @
e994d503
...
...
@@ -273,10 +273,10 @@ static void process_attach(void)
/* setup TSX11 locking */
#ifdef NO_REENTRANT_X11
old_errno_location
=
(
void
*
)
InterlockedExchange
(
(
PLONG
)
&
wine_errno_location
,
(
LONG
)
x11_errno_location
);
old_h_errno_location
=
(
void
*
)
InterlockedExchange
(
(
PLONG
)
&
wine_h_errno_location
,
(
LONG
)
x11_h_errno_location
);
old_errno_location
=
InterlockedExchangePointer
(
&
wine_errno_location
,
x11_errno_location
);
old_h_errno_location
=
InterlockedExchangePointer
(
&
wine_h_errno_location
,
x11_h_errno_location
);
#endif
/* NO_REENTRANT_X11 */
old_tsx11_lock
=
wine_tsx11_lock
;
old_tsx11_unlock
=
wine_tsx11_unlock
;
...
...
include/winbase.h
View file @
e994d503
...
...
@@ -1933,10 +1933,10 @@ BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len
#if defined(__i386__) && defined(__GNUC__)
extern
inline
PVOID
WINAPI
InterlockedCompareExchange
(
PVOID
*
dest
,
PVOID
xchg
,
PVOID
compare
);
extern
inline
PVOID
WINAPI
InterlockedCompareExchange
(
PVOID
*
dest
,
PVOID
xchg
,
PVOID
compare
)
extern
inline
LONG
WINAPI
InterlockedCompareExchange
(
PLONG
dest
,
LONG
xchg
,
LONG
compare
);
extern
inline
LONG
WINAPI
InterlockedCompareExchange
(
PLONG
dest
,
LONG
xchg
,
LONG
compare
)
{
PVOID
ret
;
LONG
ret
;
__asm__
__volatile__
(
"lock; cmpxchgl %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
return
ret
;
...
...
@@ -1951,6 +1951,24 @@ extern inline LONG WINAPI InterlockedExchange( PLONG dest, LONG val )
return
ret
;
}
extern
inline
PVOID
WINAPI
InterlockedCompareExchangePointer
(
PVOID
*
dest
,
PVOID
xchg
,
PVOID
compare
);
extern
inline
PVOID
WINAPI
InterlockedCompareExchangePointer
(
PVOID
*
dest
,
PVOID
xchg
,
PVOID
compare
)
{
PVOID
ret
;
__asm__
__volatile__
(
"lock; cmpxchgl %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
return
ret
;
}
extern
inline
PVOID
WINAPI
InterlockedExchangePointer
(
PVOID
*
dest
,
PVOID
val
);
extern
inline
PVOID
WINAPI
InterlockedExchangePointer
(
PVOID
*
dest
,
PVOID
val
)
{
PVOID
ret
;
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
return
ret
;
}
extern
inline
LONG
WINAPI
InterlockedExchangeAdd
(
PLONG
dest
,
LONG
incr
);
extern
inline
LONG
WINAPI
InterlockedExchangeAdd
(
PLONG
dest
,
LONG
incr
)
{
...
...
@@ -2015,12 +2033,17 @@ DWORD WINAPI GetCurrentProcessId(void);
DWORD
WINAPI
GetCurrentThreadId
(
void
);
DWORD
WINAPI
GetLastError
(
void
);
HANDLE
WINAPI
GetProcessHeap
(
void
);
PVOID
WINAPI
InterlockedCompareExchange
(
PVOID
*
,
PVOID
,
PVOID
);
LONG
WINAPI
InterlockedCompareExchange
(
LONG
*
,
LONG
,
LONG
);
LONG
WINAPI
InterlockedDecrement
(
PLONG
);
LONG
WINAPI
InterlockedExchange
(
PLONG
,
LONG
);
LONG
WINAPI
InterlockedExchangeAdd
(
PLONG
,
LONG
);
LONG
WINAPI
InterlockedIncrement
(
PLONG
);
VOID
WINAPI
SetLastError
(
DWORD
);
/* FIXME: should handle platforms where sizeof(void*) != sizeof(long) */
#define InterlockedCompareExchangePointer(a,b,c) \
((PVOID)InterlockedCompareExchange((PLONG)(a),(LONG)(b),(LONG)(c)))
#define InterlockedExchangePointer(a,b) \
((PVOID)InterlockedExchange((PLONG)(a),(LONG)(b)))
#endif
/* __i386__ && __GNUC__ */
#ifdef __WINE__
...
...
scheduler/critsection.c
View file @
e994d503
...
...
@@ -153,7 +153,7 @@ static lwp_mutex_t interlocked_mutex = DEFAULTMUTEX;
/***********************************************************************
* InterlockedCompareExchange (KERNEL32.@)
*/
PVOID
WINAPI
InterlockedCompareExchange
(
PVOID
*
dest
,
PVOID
xchg
,
PVOID
compare
)
LONG
WINAPI
InterlockedCompareExchange
(
PLONG
dest
,
LONG
xchg
,
LONG
compare
)
{
_lwp_mutex_lock
(
&
interlocked_mutex
);
...
...
scheduler/pthread.c
View file @
e994d503
...
...
@@ -104,7 +104,7 @@ int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
static
pthread_once_t
the_once
=
PTHREAD_ONCE_INIT
;
LONG
once_now
=
*
(
LONG
*
)
&
the_once
;
if
(
InterlockedCompareExchange
((
PVOID
*
)
once_control
,
(
PVOID
)(
once_now
+
1
),
(
PVOID
)
once_now
)
==
(
PVOID
)
once_now
)
if
(
InterlockedCompareExchange
((
LONG
*
)
once_control
,
once_now
+
1
,
once_now
)
==
once_now
)
(
*
init_routine
)();
return
0
;
}
...
...
@@ -188,7 +188,7 @@ static void mutex_real_init( pthread_mutex_t *mutex )
CRITICAL_SECTION
*
critsect
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CRITICAL_SECTION
));
InitializeCriticalSection
(
critsect
);
if
(
InterlockedCompareExchange
((
PVOID
*
)
&
(((
wine_mutex
)
mutex
)
->
critsect
),
critsect
,
NULL
)
!=
NULL
)
{
if
(
InterlockedCompareExchange
Pointer
((
void
*
*
)
&
(((
wine_mutex
)
mutex
)
->
critsect
),
critsect
,
NULL
)
!=
NULL
)
{
/* too late, some other thread already did it */
DeleteCriticalSection
(
critsect
);
HeapFree
(
GetProcessHeap
(),
0
,
critsect
);
...
...
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