mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 01:15:52 +00:00
Merge branch 'master' into sh_merge_master
This commit is contained in:
commit
c6c9a9e59b
2
.github/workflows/pip.yml
vendored
2
.github/workflows/pip.yml
vendored
@ -103,7 +103,7 @@ jobs:
|
|||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: Generate artifact attestation for sdist and wheel
|
- name: Generate artifact attestation for sdist and wheel
|
||||||
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
|
uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3
|
||||||
with:
|
with:
|
||||||
subject-path: "*/pybind11*"
|
subject-path: "*/pybind11*"
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#ifdef Py_GIL_DISABLED
|
||||||
|
# include <atomic>
|
||||||
|
#endif
|
||||||
|
|
||||||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
||||||
|
|
||||||
// Use the `gil_safe_call_once_and_store` class below instead of the naive
|
// Use the `gil_safe_call_once_and_store` class below instead of the naive
|
||||||
@ -82,7 +86,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
alignas(T) char storage_[sizeof(T)] = {};
|
alignas(T) char storage_[sizeof(T)] = {};
|
||||||
std::once_flag once_flag_ = {};
|
std::once_flag once_flag_ = {};
|
||||||
bool is_initialized_ = false;
|
#ifdef Py_GIL_DISABLED
|
||||||
|
std::atomic_bool
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
#endif
|
||||||
|
is_initialized_{false};
|
||||||
// The `is_initialized_`-`storage_` pair is very similar to `std::optional`,
|
// The `is_initialized_`-`storage_` pair is very similar to `std::optional`,
|
||||||
// but the latter does not have the triviality properties of former,
|
// but the latter does not have the triviality properties of former,
|
||||||
// therefore `std::optional` is not a viable alternative here.
|
// therefore `std::optional` is not a viable alternative here.
|
||||||
|
Loading…
Reference in New Issue
Block a user