- 23 Feb, 2022 1 commit
-
-
Edward Thomson committed
-
- 14 Nov, 2021 1 commit
-
-
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
-
- 11 Nov, 2021 1 commit
-
-
Threading can now be disabled with `USE_THREADS=OFF` instead of `THREADSAFE=OFF` to better support the other cmake semantics. Nanosecond support is the default _if_ we can detect it. This should be our default always - like threads - and people can opt out explicitly.
Edward Thomson committed
-
- 26 Aug, 2021 1 commit
-
-
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
-
- 08 Dec, 2020 1 commit
-
-
Use a no-allocation approach to the TLS data abstraction.
Edward Thomson committed
-
- 06 Dec, 2020 5 commits
-
-
This adds a generic TLS interface for anyone to store TLS data. It is designed to work regardless of whether threading support is built into the library or not. Nobody in the library should directly interface with the data on the TLS struct, so it's been built to be opaque even in the library. Requires the allocator to be initialized before use.
Tyler Ang-Wanek committed -
Edward Thomson committed
-
Edward Thomson committed
-
Clarify the `git_atomic` type and functions now that we have a 64 bit version as well (`git_atomic64`).
Edward Thomson committed -
The number of CPUs is useful information for creating a thread pool or a number of workers, but it's not really about threading directly. Evict it from the thread file
Edward Thomson committed
-
- 05 Dec, 2020 1 commit
-
-
The git__noop function is more largely useful; move it into the util header. (And reduce the number of underscores.)
Edward Thomson committed
-
- 02 Nov, 2020 1 commit
-
-
This change avoids using the `(void)0` construct for some of the mutex `#define`s, since that makes the "return type" of those "functions" to be `void` instead of `int`.
lhchavez committed
-
- 13 Oct, 2020 1 commit
-
-
This should allow folks that build in non-thread-safe environments to still be able to build the library. Fixes: #5663
lhchavez committed
-
- 11 Oct, 2020 1 commit
-
-
Instead of treating win32 thread initialization specially in the win32 git_libgit2_init function, add a git_global_threads_init function.
Edward Thomson committed
-
- 08 Oct, 2020 2 commits
-
-
Instead, globally initialize the system page size.
lhchavez committed -
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
-
- 01 Feb, 2018 1 commit
-
-
use consistent names for the #include / #define header guard pattern.
Edward Thomson committed
-
- 22 Feb, 2017 1 commit
-
-
Provide a descriptive error message when compiling THREADSAFE on gcc versions < 4.1. We require the atomic primitives (eg `__sync_synchronize`) that were introduced in that version. (Note, clang setes `__GNUC__` but appears to set its version > 4.1.)
Edward Thomson committed
-
- 20 Jun, 2016 6 commits
-
-
The old pthread-file did re-implement the pthreads API with exact symbol matching. As the thread-abstraction has now been split up between Unix- and Windows-specific files within the `git_` namespace to avoid symbol-clashes between libgit2 and pthreads, the rewritten wrappers have nothing to do with pthreads anymore. Rename the Windows-specific pthread-files to honor this change.
Patrick Steinhardt committed -
Patrick Steinhardt committed
-
Patrick Steinhardt committed
-
Patrick Steinhardt committed
-
Patrick Steinhardt committed
-
Patrick Steinhardt committed
-
- 09 Feb, 2016 1 commit
-
-
Use the gcc-like memory barrier (__sync_synchronize) on mingw.
Edward Thomson committed
-
- 27 Oct, 2014 1 commit
-
-
Edward Thomson committed
-
- 08 Sep, 2014 1 commit
-
-
The compiler was generating a bunch of warnings for git_mutex_init and git_mutex_lock when GIT_THREADS was not defined (i.e. when not using -DTHREADSAFE=ON). Also remove an unused variable from tests/path/core.c.
Sam Clegg committed
-
- 03 Jul, 2014 1 commit
-
-
Move the definition of git_thread_yield() to the test which needs it and add the correct definition for it for FreeBSD and derivatives. Original patch adding FreeBSD and derivatives by @jacquesg.
Carlos Martín Nieto committed
-
- 07 Jun, 2014 2 commits
-
-
Philip Kelley committed
-
Philip Kelley committed
-
- 17 Apr, 2014 1 commit
-
-
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
-
- 26 Aug, 2013 1 commit
-
-
This loads SRWLock APIs at runtime and in their absence (i.e. on Windows before Vista) falls back on a regular CRITICAL_SECTION that will not permit concurrent readers.
Russell Belfer committed
-
- 22 Aug, 2013 3 commits
-
-
This makes libgit2 require Windows Vista or newer if it is going to be compiled with the THREADSAFE option
Russell Belfer committed -
Russell Belfer committed
-
This is the first use we have of pthread_rwlock_t in libgit2. Hopefully it won't cause any serious portability problems.
Russell Belfer committed
-
- 11 Jul, 2013 1 commit
-
-
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
-
- 10 Jul, 2013 1 commit
-
-
Russell Belfer committed
-
- 29 Jun, 2013 1 commit
-
-
nulltoken committed
-
- 10 Jun, 2013 1 commit
-
-
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
-
- 31 May, 2013 1 commit
-
-
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
-