MCPcopy Create free account
hub / github.com/pybind/pybind11 / TEST_SUBMODULE

Function TEST_SUBMODULE

tests/test_scoped_critical_section.cpp:245–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243} // namespace test_scoped_critical_section_ns
244
245TEST_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}

Callers

nothing calls this directly

Calls 6

ptrMethod · 0.80
attrMethod · 0.80
handleFunction · 0.50

Tested by

no test coverage detected