Re: Safe to use stdatomic.h?
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Mar 20, 2017, 23:22 UTC
- Message-ID
- <20170320232240.k3egololfj7wt5cf@genre.crustytoothpaste.net>
- In-Reply-To
- <000801d2a1b7$1ec41620$5c4c4260$@gmail.com>
On Mon, Mar 20, 2017 at 04:18:20PM -0400, Ben Peart wrote:
Show 10 quoted lines
> My college Jeff is working on a patch series to further parallelize the > loading of the index. As part of that patch, it would be nice to use the > atomic_fetch_add function as that would be more efficient than creating a > mutex simply to protect a variable so that it can be incremented. I haven't > seen any use of atomics yet in Git, nor anything that includes > <stdatomic.h>. > > GCC has supported them since 4.9 and Clang has supported them by default > since 3.3. Are there any compilers currently in use by Git that don't > support these C11 functions?
At work, we're compiling for CentOS 6 and 7. CentOS 7 only has GCC 4.8, and CentOS 6 has something much older. This is code we ship to customers, so we can't rely on them having devtoolset installed for newer GCC.
I could support the argument for ditching RHEL/CentOS 5 support, but I expect other people might disagree. After all, we're still targeting C89.
-- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204