summaryrefslogtreecommitdiff
path: root/atomic
Commit message (Collapse)AuthorAgeFilesLines
* atomic: Detect 32bit and 64bit atomic builtins separately.Yann Ylavic2022-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some 32bit platforms provide 32bit but not 64bit atomics, detect and distinctly set/use HAVE_ATOMIC_BUILTINS/HAVE_ATOMIC_BUILTINS64 and USE_ATOMICS_BUILTINS/USE_ATOMICS_BUILTINS64. These platforms NEED_ATOMICS_GENERIC64 as 64bit implementation. * configure.in(): Use stdint.h's uint{32,64}_t as atomic type for testing atomic builtins when available, otherwise "unsigned int" for 32bit testing and "unsigned long long" as 64bit. * configure.in(): AC_TRY_RUN each 32bit and 64bit type separately, the former determining HAVE_ATOMIC_BUILTINS and the latter HAVE_ATOMIC_BUILTINS64. * include/arch/unix/apr_arch_atomic.h(): Define USE_ATOMICS_BUILTINS64 when HAVE_ATOMIC_BUILTINS64, otherise define NEED_ATOMICS_GENERIC64 * include/arch/unix/apr_arch_atomic.h(): Check defined(__powerpc__) for USE_ATOMICS_PPC. * atomic/unix/builtins64.c(): Implement for USE_ATOMICS_BUILTINS64 only. BZ 63566. Merge r1902266 from trunk. Submitted by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1902290 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1896811 from trunk:Yann Ylavic2022-01-121-0/+7
| | | | | | | | | | | apr_atomic_set64: Follow up to r1868129. Like for apr_atomic_read64() in r1868502, use direct memory write on x86_x64. Submitted by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896960 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1868129, r1868502 from trunk:Yann Ylavic2021-12-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | apr_atomic_read64(): Fix non-atomic read on 32-bit Windows. * atomic/win32/apr_atomic64.c (apr_atomic_read64): Use InterlockedCompareExchange64() instead of direct memory read. * test/testatomic.c (test_atomics_threaded_setread64): New test. (test_func_set64): Helepr for test_atomics_threaded_setread64 test. * CHANGES: Add changelog entry. * atomic/win32/apr_atomic64.c (apr_atomic_read64): Use direct memory read when compiled for x86_x64, since 64-bit reads are atomic in 64-bit Windows [1]. Suggested by: Yann Ylavic [1] https://docs.microsoft.com/en-us/windows/win32/sync/interlocked-variable-access Submitted by: ivan Reviewed by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896068 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1894621, r1894719, r1894622 from trunk:Yann Ylavic2021-12-163-27/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | apr_atomic: Use __atomic builtins when available. Unlike Intel's atomic builtins (__sync_*), the more recent __atomic builtins provide atomic load and store for weakly ordered architectures like ARM32 or powerpc[64], so use them when available (gcc 4.6.3+). Follow up to r1894621: restore apr_atomic_init::apr__atomic_generic64_init(). Even if apr__atomic_generic64_init() is currently a noop when !APR_HAS_THREADS, it may change later without apr_atomic_init() noticing (thanks Rüdiger). apr_atomic: Fix load/store for weak memory ordering architectures. Volatile access prevents compiler reordering of load/store but it's not enough for weakly ordered archs like ARM32 and PowerPC[64]. While __atomic builtins provide load and store, __sync builtins don't so let's use an atomic add of zero for the former and atomic exchange for the latter. The assembly code for PowerPC was not correct either, fix apr_atomic_read32() and apr_atomic_set32() and add the necessary memory barriers for the others. PR 50586. Submitted by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896067 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1856873 from trunk:Yann Ylavic2020-04-301-39/+11
| | | | | | | Address some warnings raised by MSVC-32/64. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1877195 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1851541 from trunk:Yann Ylavic2019-03-079-12/+37
| | | | | | | | | | | | | | atomics: follow up to r1841078: provide specific initializer for generic 64bit The can't be two apr_atomic_init(), atomic/mutex64.c shouldn't implement one since generic/mutex implementation may be used by several platforms. So introduce private apr__atomic_generic64_init() and use it where needed. [Follow up to r1841109 in 1.7.x] git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1854993 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1841078 from trunk:Jim Jagielski2018-09-173-0/+335
| | | | | | | | | Add in Atomics for 64bit ints Reviewed by: jim git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1841109 13f79535-47bb-0310-9956-ffa450edef68
* Backport r1675751 from trunkGregg Lewis Smith2015-04-241-49/+8
| | | | | | | | | | | | Fix errors when building on Visual Studio 2013 while maintaining the ability to build on Visual Studio 6 with Windows Server 2003 R2 SDK. PR: 57191 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1675753 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1470348:Stefan Fritsch2013-04-211-1/+1
| | | | | | | | | | Fix amd64 assembler version of apr_atomic_xchgptr() PR: 51851 Submitted by: Mattias Engdegård <mattiase acm org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1470349 13f79535-47bb-0310-9956-ffa450edef68
* Merge r1470186:Stefan Fritsch2013-04-201-24/+24
| | | | | | | | | | Fix PPC atomics to work with gcc 4.0 PR: 54840 Submitted by: Mattias Engdegård <mattiase acm org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1470189 13f79535-47bb-0310-9956-ffa450edef68
* Merge r925965:Stefan Fritsch2013-04-202-84/+84
| | | | | | | Some folks are ignoring the Tab prohibitions git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1470188 13f79535-47bb-0310-9956-ffa450edef68
* Added blocking for MSVC pragma.Guenter Knauf2011-03-251-0/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1085462 13f79535-47bb-0310-9956-ffa450edef68
* * Fix some gcc compiler warnings on SolarisRuediger Pluem2008-06-041-1/+1
| | | | | | | Patch to atomic/unix/solaris.c submitted by: Henry Jen <henryjen ztune.net> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@663342 13f79535-47bb-0310-9956-ffa450edef68
* Apparently I'm too wordy, even the compiler agrees.William A. Rowe Jr2007-10-241-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@588081 13f79535-47bb-0310-9956-ffa450edef68
* Match win32's volatility declaration (except for mingw)William A. Rowe Jr2007-10-231-1/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@587593 13f79535-47bb-0310-9956-ffa450edef68
* implement apr_atomic_xchgptr() for z/OSJeff Trawick2007-10-221-0/+17
| | | | | | | | Submitted by: David Jones <oscaremma gmail.com> reviewed by: trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@587057 13f79535-47bb-0310-9956-ffa450edef68
* Implement apr_atomic_casptr() for z/OS.Jeff Trawick2007-10-181-0/+24
| | | | | | | | Submitted by: David Jones <oscaremma gmail.com> Reviewed by: trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@585935 13f79535-47bb-0310-9956-ffa450edef68
* * Fix compiler warning.Ruediger Pluem2007-10-141-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584523 13f79535-47bb-0310-9956-ffa450edef68
* * Dereference mem as it is a double pointer.Ruediger Pluem2007-10-141-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584522 13f79535-47bb-0310-9956-ffa450edef68
* Cleanup asm constraints (+ operand is both read and written by the instruction)Davi Arnaut2007-08-041-12/+9
| | | | | | | and clobbers. The xchg instruction always asserts the lock signal. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@562765 13f79535-47bb-0310-9956-ffa450edef68
* Prefer solaris builtins even on x86, and fix a compiler warning.Davi Arnaut2007-08-041-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@562764 13f79535-47bb-0310-9956-ffa450edef68
* Fix win32 stub for apr_atomic_xchgptr.Davi Arnaut2007-07-121-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@555695 13f79535-47bb-0310-9956-ffa450edef68
* Fix a mis-merge of PPC memory barriers.Davi Arnaut2007-07-111-4/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@555258 13f79535-47bb-0310-9956-ffa450edef68
* Introduce apr_atomic_xchgptr, which atomically exchanges a pair of pointerDavi Arnaut2007-07-108-0/+116
| | | | | | | values. Missing OS/390 implementation. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@554995 13f79535-47bb-0310-9956-ffa450edef68
* New apr_atomic implementation for S/390 native atomic operations.Davi Arnaut2007-07-071-0/+132
| | | | | | | Tested on: RHEL AS 4 (Nahant Update 4), IBM/S390, running under VM (64 bit mode), gcc 3.4.6 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@554095 13f79535-47bb-0310-9956-ffa450edef68
* New apr_atomic implementation for PowerPC native atomic operations.Davi Arnaut2007-07-041-0/+178
| | | | | | | PR: 42806 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@553293 13f79535-47bb-0310-9956-ffa450edef68
* New apr_atomic implementation for Solaris 10 native atomic operations.Davi Arnaut2007-07-041-0/+74
| | | | | | | PR: 42806 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@553292 13f79535-47bb-0310-9956-ffa450edef68
* New apr_atomic implementation for ia32 (x86 and x86_64) native atomic ↵Davi Arnaut2007-07-041-0/+111
| | | | | | | | | | | | operations, plus apr_atomic_casptr. PR: 42806 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@553291 13f79535-47bb-0310-9956-ffa450edef68
* Given a modern compiler, this patch provides fast atomic operations on variousDavi Arnaut2007-07-041-0/+74
| | | | | | | | | | | | | | platforms (alpha, ia32, ia64, powerpc, etc). Tested on: 2x Pentium D, Ubuntu 7.04, gcc 4.1.2 16x Itanium II, RHEL 5, gcc 4.1.1 PR: 42806 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@553290 13f79535-47bb-0310-9956-ffa450edef68
* This patch tries to address some of the apr_atomic problems by reorganizingDavi Arnaut2007-07-042-464/+192
| | | | | | | | | | the various backends. The generic implementation is used when no specialized implementation fits the defined criterias, or when the user forces the choice. PR: 42806 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@553289 13f79535-47bb-0310-9956-ffa450edef68
* Avoid overwriting the hash_mutex table for applications that incorrectly callsDavi Arnaut2007-06-301-0/+16
| | | | | | | | | | apr_atomic_init(). Noticied by: Tim Jones PR: 42760 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@552161 13f79535-47bb-0310-9956-ffa450edef68
* Fix up integer type on Solaris 10 (gcc) compiles.Justin Erenkrantz2006-08-311-1/+1
| | | | | | | | | * atomic/unix/apr_atomic.c (apr_atomic_dec32): Match declaration in apr_atomic.h for Solaris 10 implementation. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@438796 13f79535-47bb-0310-9956-ffa450edef68
* Fix the typo.Joe Orton2006-08-034-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428317 13f79535-47bb-0310-9956-ffa450edef68
* Update license header.Joe Orton2006-08-034-24/+24
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428313 13f79535-47bb-0310-9956-ffa450edef68
* Add __MINGW32__ versions of the Win32 Atomic functions, that all do their ↵Paul Querna2006-07-151-1/+15
| | | | | | own evil casting -- but it allows 100% of the testatomic cases to pass, when previously, it aborted if you tried to call any of the atomic functions. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@422168 13f79535-47bb-0310-9956-ffa450edef68
* Implement apr_atomics using Solaris' native atomic API.Colm MacCarthaigh2006-06-131-0/+55
| | | | | | | | | | | | | | | | | | * Use each of the atomic_ functions that we can. * atomic_add is NOT implemented, as Solaris' implementation can handle only signed deltas. * each function is conditionalised on its corresponding APR_OVERRIDE_* macro to avoid double-implementation. On Solaris x86/x64 with gcc we implement atomics using our inline assembly. Thank to: Mads Toftum for pointing out atomic_cas git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@413786 13f79535-47bb-0310-9956-ffa450edef68
* These args can't be volatile in MSVC 14.William A. Rowe Jr2006-01-131-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@368549 13f79535-47bb-0310-9956-ffa450edef68
* These operations are NOT necessarily function-based on 64 bitWilliam A. Rowe Jr2005-05-161-0/+20
| | | | | | | | | architectures. Performed with inline code, these function cast wrappers broke our API. These original flavors should be present for all 64 bit compiler headers. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@170467 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright year to 2005 and standardize on current copyright owner line.Justin Erenkrantz2005-02-044-4/+8
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@151412 13f79535-47bb-0310-9956-ffa450edef68
* Remove .cvsignore files.Joe Orton2004-11-182-8/+0
| | | | | | | Tipped-of-by: Uwe Zeisberger git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@76269 13f79535-47bb-0310-9956-ffa450edef68
* WIN64: avoid unresolved external error with 64 bit buildAllan K. Edwards2004-09-201-0/+8
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65336 13f79535-47bb-0310-9956-ffa450edef68
* * atomic/unix/apr_atomic.c: Force use of generic atomics if gccJoe Orton2004-09-131-0/+6
| | | | | | | | defines __STRICT_ANSI__ (e.g. with -std=c89), since inline asm is not supported in that case. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65328 13f79535-47bb-0310-9956-ffa450edef68
* Fixed apr_atomic_dec on NetWare to be thread safeJean-Jacques Clar2004-09-021-2/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65325 13f79535-47bb-0310-9956-ffa450edef68
* Quiet build breakage on VC6 with the originally shipped includesWilliam A. Rowe Jr2004-04-161-5/+16
| | | | | | | | | | (InterlockedCompareExchangePointer available in later SDK headers.) Few should be compiling on 64 bit cpu's under VC6 anymore, so ignore that edge case. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65063 13f79535-47bb-0310-9956-ffa450edef68
* Relicense.Joe Orton2004-02-281-49/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64930 13f79535-47bb-0310-9956-ffa450edef68
* Relicense APR under Apache License, Version 2.0Justin Erenkrantz2004-02-133-147/+30
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64904 13f79535-47bb-0310-9956-ffa450edef68
* First whack at switching to a single top-level make. This adds a dependencyGreg Stein2004-02-052-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | upon Python at packaging time, but not at end-user config/build time. As far as I can tell, the build continues to function properly. (out-of-dir config/make not tested, and apr-iconv prolly needs some work) The buildconf scripts now generate a build-outputs.mk file which is included by the root's Makefile (via the build/gen-build.py script). bulid-outputs.mk specifies all of the various files present in the distribution. The top-level Makefiles were simplified to use an $(OBJECTS) symbol rather than 'find'ing them. Similarly, a $(HEADERS) symbol is used for the exports. The corresponding delete-* targets were eliminated since we have a precise set of inputs. The subdirs' Makefiles were removed since they are no longer called/used. The apr-util/uri Makefile was responsible for compiling a C program to generate the uri_delims.h file. That process was replaced by a Python script to generate the header (called by buildconf). The .c and .dsp were left for the Windows build to continue, but that should be revamped. build/apr_rules.mk was revamped somewhat to avoid recursion, but a lot of cleanup is still needed. Much of the recursive/local/x- logic is no longer needed and can be elimianated. rules.mk was created for inclusion by N makefiles, but that isn't really true any more, so it could probably be tossed (caveat: test/Makefile). Saved for a phase 2. Some additional work was added to properly clean up files in */build/, rather than relying on a makefile in there. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64891 13f79535-47bb-0310-9956-ffa450edef68
* Clean up configure logic for enabling "nonportable" atomics: don'tJoe Orton2004-01-061-2/+6
| | | | | | | | | | | | | | | | export the result via apr.h, and enable use of inline asm by default on ppc64 and x86_64. * configure.in: Define USE_GENERIC_ATOMICS on i[456]86 unless --enable-nonportable-atomics was used. * include/apr.h.in: Remove APR_FORCE_GENERIC_ATOMICS. * atomic/unix/apr_atomic.c: Check for !defined(USE_GENERIC_ATOMICS) rather than defined(APR_FORCE_GENERIC_ATOMICS). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64861 13f79535-47bb-0310-9956-ffa450edef68
* * atomic/unix/apr_atomic.c: Enable x86 asm on AMD64.Joe Orton2004-01-061-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64859 13f79535-47bb-0310-9956-ffa450edef68
* * atomic/solaris_sparc: Remove now-unused leftovers ofJoe Orton2003-12-313-33/+0
| | | | | | | Solaris/SPARC-specific atomics. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64854 13f79535-47bb-0310-9956-ffa450edef68