Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
af6066c2
Commit
af6066c2
authored
9 years ago
by
Grazvydas Ignotas
Committed by
Alexandre Julliard
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
port.h: Make use of compiler support for pointer atomic ops.
parent
ae8408f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/wine/port.h
+16
-0
16 additions, 0 deletions
include/wine/port.h
libs/port/interlocked.c
+6
-0
6 additions, 0 deletions
libs/port/interlocked.c
with
22 additions
and
0 deletions
include/wine/port.h
+
16
−
0
View file @
af6066c2
...
...
@@ -456,8 +456,24 @@ extern int interlocked_xchg_add( int *dest, int incr );
extern
int
interlocked_xchg
(
int
*
dest
,
int
val
);
#endif
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __SIZEOF_POINTER__ == 4) \
|| (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) && __SIZEOF_POINTER__ == 8)
static
inline
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
inline
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
)
{
void
*
ret
;
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
return
ret
;
}
#else
extern
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
);
extern
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
);
#endif
#if defined(__x86_64__) || defined(__aarch64__) || defined(_WIN64)
extern
unsigned
char
interlocked_cmpxchg128
(
__int64
*
dest
,
__int64
xchg_high
,
__int64
xchg_low
,
__int64
*
compare
);
...
...
This diff is collapsed.
Click to expand it.
libs/port/interlocked.c
+
6
−
0
View file @
af6066c2
...
...
@@ -289,6 +289,8 @@ int interlocked_cmpxchg( int *dest, int xchg, int compare )
}
#endif
#if !(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __SIZEOF_POINTER__ == 4) \
&& !(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) && __SIZEOF_POINTER__ == 8)
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
)
{
pthread_mutex_lock
(
&
interlocked_mutex
);
...
...
@@ -301,6 +303,7 @@ void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare )
pthread_mutex_unlock
(
&
interlocked_mutex
);
return
compare
;
}
#endif
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
__int64
interlocked_cmpxchg64
(
__int64
*
dest
,
__int64
xchg
,
__int64
compare
)
...
...
@@ -329,6 +332,8 @@ int interlocked_xchg( int *dest, int val )
}
#endif
#if !(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __SIZEOF_POINTER__ == 4) \
&& !(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) && __SIZEOF_POINTER__ == 8)
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
)
{
void
*
retv
;
...
...
@@ -338,6 +343,7 @@ void *interlocked_xchg_ptr( void **dest, void *val )
pthread_mutex_unlock
(
&
interlocked_mutex
);
return
retv
;
}
#endif
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
int
interlocked_xchg_add
(
int
*
dest
,
int
incr
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment