]>
Commit | Line | Data |
---|---|---|
cf17c47d JR |
1 | --- webkitgtk-2.0.0/configure.ac.orig 2013-04-12 08:25:14.896829422 +0200 |
2 | +++ webkitgtk-2.0.0/configure.ac 2013-04-12 08:27:21.244776999 +0200 | |
3 | @@ -32,6 +32,18 @@ | |
4 | AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip tar-ustar]) | |
5 | m4_include([Source/autotools/SetupAutomake.m4]) | |
6 | ||
7 | +dnl Check whether the target supports 64-bit __sync_*_compare_and_swap. | |
8 | +AC_TRY_LINK([#include <stdint.h>], | |
9 | + [uint64_t foo, bar; | |
10 | + bar = __sync_val_compare_and_swap(&foo, 0, 1);], | |
11 | + wtf_cv_have_64bit_sync_builtins=yes, | |
12 | + wtf_cv_have_64bit_sync_builtins=no) | |
13 | + | |
14 | +if test $wtf_cv_have_64bit_sync_builtins = yes; then | |
15 | + AC_DEFINE(HAVE_64BIT_SYNC_BUILTINS, 1, | |
16 | + [Define to 1 if the target supports 64-bit __sync_*_compare_and_swap]) | |
17 | +fi | |
18 | + | |
19 | ###################################################################################### | |
20 | # Processing of configuration files | |
21 | ###################################################################################### | |
22 | --- webkitgtk-2.0.0/Source/WTF/wtf/Atomics.h~ 2013-04-12 08:05:55.951740895 +0200 | |
23 | +++ webkitgtk-2.0.0/Source/WTF/wtf/Atomics.h 2013-04-12 08:22:46.701992338 +0200 | |
3ccee296 JR |
24 | @@ -70,6 +70,9 @@ |
25 | #elif OS(ANDROID) | |
26 | #include <sys/atomics.h> | |
27 | #endif | |
fa360827 | 28 | +#ifndef HAVE_64BIT_SYNC_BUILTINS |
3ccee296 JR |
29 | +#include <pthread.h> |
30 | +#endif | |
31 | ||
32 | namespace WTF { | |
33 | ||
34 | @@ -113,8 +113,15 @@ | |
cf17c47d JR |
35 | inline int atomicIncrement(int volatile* addend) { return __sync_add_and_fetch(addend, 1); } |
36 | inline int atomicDecrement(int volatile* addend) { return __sync_sub_and_fetch(addend, 1); } | |
37 | ||
38 | +#ifdef HAVE_64BIT_SYNC_BUILTINS | |
39 | inline int64_t atomicIncrement(int64_t volatile* addend) { return __sync_add_and_fetch(addend, 1); } | |
40 | inline int64_t atomicDecrement(int64_t volatile* addend) { return __sync_sub_and_fetch(addend, 1); } | |
41 | +#else | |
42 | +static pthread_mutex_t global_wtf_lock = PTHREAD_MUTEX_INITIALIZER; | |
43 | + | |
49eec344 JR |
44 | +inline int64_t atomicIncrement(int64_t volatile* addend) { pthread_mutex_lock(&global_wtf_lock); int64_t v = (*addend)++; pthread_mutex_unlock(&global_wtf_lock); return v; } |
45 | +inline int64_t atomicDecrement(int64_t volatile* addend) { pthread_mutex_lock(&global_wtf_lock); int64_t v = (*addend)--; pthread_mutex_unlock(&global_wtf_lock); return v; } | |
cf17c47d JR |
46 | +#endif |
47 | ||
48 | #endif | |
49 |