1. 23 Feb, 2022 1 commit
  2. 14 Nov, 2021 1 commit
    • Fix a gcc 11 warning in src/thread.h · 5675312e
      When building under gcc 11, there is a warning about an incompatible pointer
      type, since
      [`__atomic_exchange`](https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html)
      does not take `volatile` pointers:
      
      ```
      In file included from ../src/common.h:81,
                       from ../src/transports/winhttp.c:8:
      ../src/thread-utils.h: In function ‘git___swap’:
      ../src/thread-utils.h:168:9: warning: argument 3 of ‘__atomic_exchange’ discards ‘volatile’ qualifier [-Wincompatible-pointer-types]
        168 |         __atomic_exchange(ptr, &newval, &foundval, __ATOMIC_SEQ_CST);
            |         ^~~~~~~~~~~~~~~~~
      ```
      
      This change drops the `volatile` qualifier so that the pointer type matches
      what `__atomic_exchange` expects.
      lhchavez committed
  3. 11 Nov, 2021 1 commit
  4. 26 Aug, 2021 1 commit
    • Homogenize semantics for atomic-related functions · 74708a81
      There were some subtle semantic differences between the various
      implementations of atomic functions. Now they behave the same, have
      tests and are better documented to avoid this from happening again in
      the future.
      
      Of note:
      
      * The semantics chosen for `git_atomic_compare_and_swap` match
        `InterlockedCompareExchangePointer`/`__sync_cal_compare_and_swap` now.
      * The semantics chosen for `git_atomic_add` match
        `InterlockedAdd`/`__atomic_add_fetch`.
      * `git_atomic_swap` and `git_atomic_load` still have a bit of semantic
        difference with the gcc builtins / msvc interlocked operations, since
        they require an l-value (not a pointer). If desired, this can be
        homogenized.
      lhchavez committed
  5. 08 Dec, 2020 1 commit
  6. 06 Dec, 2020 5 commits
  7. 05 Dec, 2020 1 commit
  8. 02 Nov, 2020 1 commit
  9. 13 Oct, 2020 1 commit
  10. 11 Oct, 2020 1 commit
  11. 08 Oct, 2020 2 commits
    • Avoid using atomics in pool.c · 03c0938f
      Instead, globally initialize the system page size.
      lhchavez committed
    • Improve the support of atomics · cc1d7f5c
      This change:
      
      * Starts using GCC's and clang's `__atomic_*` intrinsics instead of the
        `__sync_*` ones, since the former supercede the latter (and can be
        safely replaced by their equivalent `__atomic_*` version with the
        sequentially consistent model).
      * Makes `git_atomic64`'s value `volatile`. Otherwise, this will make
        ThreadSanitizer complain.
      * Adds ways to load the values from atomics. As it turns out,
        unsynchronized read are okay only in some architectures, but if we
        want to be correct (and make ThreadSanitizer happy), those loads
        should also be performed with the atomic builtins.
      * Fixes two ThreadSanitizer warnings, as a proof-of-concept that this
        works:
        - Avoid directly accessing `git_refcount`'s `owner` directly, and
          instead makes all callers go through the `GIT_REFCOUNT_*()` macros,
          which also use the atomic utilities.
        - Makes `pool_system_page_size()` race-free.
      
      Part of: #5592
      lhchavez committed
  12. 01 Feb, 2018 1 commit
  13. 22 Feb, 2017 1 commit
  14. 20 Jun, 2016 6 commits
  15. 09 Feb, 2016 1 commit
  16. 27 Oct, 2014 1 commit
  17. 08 Sep, 2014 1 commit
  18. 03 Jul, 2014 1 commit
  19. 07 Jun, 2014 2 commits
  20. 17 Apr, 2014 1 commit
    • Index locking and entry allocation changes · 8a2834d3
      This makes the lock management on the index a little bit broader,
      having a number of routines hold the lock across looking up the
      item to be modified and actually making the modification.  Still
      not true thread safety, but more pure index modifications are now
      safe which allows the simple cases (such as starting up a diff
      while index modifications are underway) safe enough to get the
      snapshot without hitting allocation problems.
      
      As part of this, I simplified the allocation of index entries to
      use a flex array and just put the path at the end of the index
      entry.  This makes every entry self-contained and makes it a
      little easier to feel sure that pointers to strings aren't
      being accidentally copied and freed while other references are
      still being held.
      Russell Belfer committed
  21. 26 Aug, 2013 1 commit
  22. 22 Aug, 2013 3 commits
  23. 11 Jul, 2013 1 commit
    • Update git__swap thread helper · 814de0bc
      This makes git__swap use the __sync_lock_test_and_set primitive
      with GCC and the InterlockedExchangePointer primitive with MSVC.
      Previously is used compare_and_swap in a way that was probably
      unintuitive for most thinking (i.e. it could fail to swap in the
      value if another thread raced in).  Now it will always succeed
      and the last thread to run in a race will win instead of the
      first thread.
      
      This also fixes up a little confusion between volatile void **
      and void * volatile * that came up with the Win32 compiler.
      Russell Belfer committed
  24. 10 Jul, 2013 1 commit
  25. 29 Jun, 2013 1 commit
  26. 10 Jun, 2013 1 commit
    • Reorganize diff and add basic diff driver · 114f5a6c
      This is a significant reorganization of the diff code to break it
      into a set of more clearly distinct files and to document the new
      organization.  Hopefully this will make the diff code easier to
      understand and to extend.
      
      This adds a new `git_diff_driver` object that looks of diff driver
      information from the attributes and the config so that things like
      function content in diff headers can be provided.  The full driver
      spec is not implemented in the commit - this is focused on the
      reorganization of the code and putting the driver hooks in place.
      
      This also removes a few #includes from src/repository.h that were
      overbroad, but as a result required extra #includes in a variety
      of places since including src/repository.h no longer results in
      pulling in the whole world.
      Russell Belfer committed
  27. 31 May, 2013 1 commit
    • Mutex init can fail · 1a42dd17
      It is obviously quite a serious problem if this happens, but mutex
      initialization can fail and we should detect it.  It's a bit like
      a memory allocation failure, in that you're probably pretty screwed
      if this occurs, but at least we'll catch it.
      Russell Belfer committed