| 243 | } // namespace test_scoped_critical_section_ns |
| 244 | |
| 245 | TEST_SUBMODULE(scoped_critical_section, m) { |
| 246 | using namespace test_scoped_critical_section_ns; |
| 247 | |
| 248 | m.def("test_one_nullptr", test_one_nullptr); |
| 249 | m.def("test_two_nullptrs", test_two_nullptrs); |
| 250 | m.def("test_first_nullptr", test_first_nullptr); |
| 251 | m.def("test_second_nullptr", test_second_nullptr); |
| 252 | |
| 253 | auto BoolWrapperClass = py::class_<BoolWrapper>(m, "BoolWrapper") |
| 254 | .def(py::init<bool>()) |
| 255 | .def("get", &BoolWrapper::get) |
| 256 | .def("set", &BoolWrapper::set); |
| 257 | auto BoolWrapperHandle = py::handle(BoolWrapperClass); |
| 258 | (void) BoolWrapperHandle.ptr(); // suppress unused variable warning |
| 259 | |
| 260 | m.attr("has_barrier") = |
| 261 | #ifdef PYBIND11_HAS_STD_BARRIER |
| 262 | true; |
| 263 | #else |
| 264 | false; |
| 265 | #endif |
| 266 | |
| 267 | m.def("test_scoped_critical_section", |
| 268 | [BoolWrapperHandle]() -> void { test_scoped_critical_section(BoolWrapperHandle); }); |
| 269 | m.def("test_scoped_critical_section2", |
| 270 | [BoolWrapperHandle]() -> void { test_scoped_critical_section2(BoolWrapperHandle); }); |
| 271 | m.def("test_scoped_critical_section2_same_object_no_deadlock", [BoolWrapperHandle]() -> void { |
| 272 | test_scoped_critical_section2_same_object_no_deadlock(BoolWrapperHandle); |
| 273 | }); |
| 274 | } |
nothing calls this directly
no test coverage detected