<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/src/thread.h, branch ethomson/prng2</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/'/>
<entry>
<title>Fix a gcc 11 warning in src/thread.h</title>
<updated>2021-11-14T10:31:48+00:00</updated>
<author>
<name>lhchavez</name>
<email>lhchavez@lhchavez.com</email>
</author>
<published>2021-11-14T10:27:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=5675312e5aeb0c8b438df3ba9da7542673b2e0e7'/>
<id>5675312e5aeb0c8b438df3ba9da7542673b2e0e7</id>
<content type='text'>
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, &amp;newval, &amp;foundval, __ATOMIC_SEQ_CST);
      |         ^~~~~~~~~~~~~~~~~
```

This change drops the `volatile` qualifier so that the pointer type matches
what `__atomic_exchange` expects.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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, &amp;newval, &amp;foundval, __ATOMIC_SEQ_CST);
      |         ^~~~~~~~~~~~~~~~~
```

This change drops the `volatile` qualifier so that the pointer type matches
what `__atomic_exchange` expects.
</pre>
</div>
</content>
</entry>
<entry>
<title>cmake: standardize USE_THREADS and USE_NSEC</title>
<updated>2021-11-11T20:56:10+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2021-11-06T20:14:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=9324d16e7356c1928d577a719eaaad264da58b13'/>
<id>9324d16e7356c1928d577a719eaaad264da58b13</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Homogenize semantics for atomic-related functions</title>
<updated>2021-08-26T12:34:17+00:00</updated>
<author>
<name>lhchavez</name>
<email>lhchavez@lhchavez.com</email>
</author>
<published>2020-12-20T20:45:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=74708a813d586df3ba22a81b475f6aba0498e2ef'/>
<id>74708a813d586df3ba22a81b475f6aba0498e2ef</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>threads: git_tls_data to git_tlsdata</title>
<updated>2020-12-08T14:53:13+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2020-12-05T22:22:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=fd2d4759ff7fb6ae038daef146fb7f5ba40c5e64'/>
<id>fd2d4759ff7fb6ae038daef146fb7f5ba40c5e64</id>
<content type='text'>
Use a no-allocation approach to the TLS data abstraction.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use a no-allocation approach to the TLS data abstraction.
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement generic TLS interface</title>
<updated>2020-12-06T01:08:22+00:00</updated>
<author>
<name>Tyler Ang-Wanek</name>
<email>tylerw@axosoft.com</email>
</author>
<published>2020-08-06T23:24:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=971b7187faa1260aab75c531d9c78b29cdba6cc4'/>
<id>971b7187faa1260aab75c531d9c78b29cdba6cc4</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>threads: rename thread files to thread.[ch]</title>
<updated>2020-12-06T01:08:22+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2020-12-05T15:57:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=404dd02443aebed284033e02ace8b791151aa7a9'/>
<id>404dd02443aebed284033e02ace8b791151aa7a9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
