Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
BIND
Commits
0dc714c4
Commit
0dc714c4
authored
Sep 05, 2018
by
Ondřej Surý
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On 32-bit Windows use only default memory ordering
parent
8360df5a
Pipeline
#4677
passed with stages
in 12 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
lib/isc/win32/include/isc/stdatomic.h
lib/isc/win32/include/isc/stdatomic.h
+19
-0
No files found.
lib/isc/win32/include/isc/stdatomic.h
View file @
0dc714c4
...
...
@@ -64,12 +64,17 @@ typedef uint_fast64_t volatile atomic_uint_fast64_t;
? InterlockedExchangeAcquire((atomic_int_fast32_t *)obj, desired) \
: InterlockedExchange((atomic_int_fast32_t *)obj, desired)))
#ifdef _WIN64
#define atomic_store_explicit64(obj, desired, order) \
(order == memory_order_relaxed \
? InterlockedExchangeNoFence64((atomic_int_fast64_t *)obj, desired) \
: (order == memory_order_acquire \
? InterlockedExchangeAcquire64((atomic_int_fast64_t *)obj, desired) \
: InterlockedExchange64((atomic_int_fast64_t *)obj, desired)))
#else
#define atomic_store_explicit64(obj, desired, order) \
InterlockedExchange64((atomic_int_fast64_t *)obj, desired)
#endif
static
inline
void
...
...
@@ -97,6 +102,7 @@ atomic_store_abort() {
? (int32_t)InterlockedOrRelease((atomic_int_fast32_t *)obj, 0) \
: (int32_t)InterlockedOr((atomic_int_fast32_t *)obj, 0))))
#ifdef _WIN64
#define atomic_load_explicit64(obj, order) \
(order == memory_order_relaxed \
? InterlockedOr64NoFence((atomic_int_fast64_t *)obj, 0) \
...
...
@@ -105,6 +111,10 @@ atomic_store_abort() {
: (order == memory_order_release \
? InterlockedOr64Release((atomic_int_fast64_t *)obj, 0) \
: InterlockedOr64((atomic_int_fast64_t *)obj, 0))))
#else
#define atomic_load_explicit64(obj, order) \
InterlockedOr64((atomic_int_fast64_t *)obj, 0)
#endif
static
inline
int8_t
...
...
@@ -132,6 +142,7 @@ atomic_load_abort() {
? InterlockedExchangeAddRelease((atomic_int_fast32_t *)obj, arg) \
: InterlockedExchange((atomic_int_fast32_t *)obj, arg))))
#ifdef _WIN64
#define atomic_fetch_add_explicit64(obj, arg, order) \
(order == memory_order_relaxed \
? InterlockedExchangeAddNoFence64((atomic_int_fast64_t *)obj, arg) \
...
...
@@ -140,6 +151,10 @@ atomic_load_abort() {
: (order == memory_order_release \
? InterlockedExchangeAddRelease64((atomic_int_fast64_t *)obj, arg) \
: InterlockedExchange64((atomic_int_fast64_t *)obj, arg))))
#else
#define atomic_fetch_add_explicit64(obj, arg, order) \
InterlockedExchange64((atomic_int_fast64_t *)obj, arg)
#endif
static
inline
int8_t
...
...
@@ -203,6 +218,7 @@ atomic_compare_exchange_strong_explicit64(atomic_int_fast64_t *obj,
bool
__r
;
int64_t
__v
;
REQUIRE
(
succ
==
fail
);
#ifdef _WIN64
switch
(
succ
)
{
case
memory_order_relaxed
:
__v
=
InterlockedCompareExchangeNoFence64
((
atomic_int_fast64_t
*
)
obj
,
desired
,
*
expected
);
...
...
@@ -217,6 +233,9 @@ atomic_compare_exchange_strong_explicit64(atomic_int_fast64_t *obj,
__v
=
InterlockedCompareExchange64
((
atomic_int_fast64_t
*
)
obj
,
desired
,
*
expected
);
break
;
}
#else
__v
=
InterlockedCompareExchange64
((
atomic_int_fast64_t
*
)
obj
,
desired
,
*
expected
);
#endif
__r
=
(
*
(
expected
)
==
__v
);
if
(
!
__r
)
{
*
(
expected
)
=
__v
;
...
...
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