10#include <pybind11/cast.h>
11#include <pybind11/pybind11.h>
23 explicit IntStruct(
int v) :
value(v){};
25 IntStruct(
const IntStruct &) =
default;
26 IntStruct &operator=(
const IntStruct &) =
default;
35 py::class_<IntStruct>(m,
"IntStruct").def(py::init([](
const int i) {
return IntStruct(i); }));
41 py::implicitly_convertible<int, IntStruct>();
43 m.def(
"test", [](
int expected,
const IntStruct &in) {
45 py::gil_scoped_release release;
46 std::this_thread::sleep_for(std::chrono::milliseconds(5));
49 if (in.value != expected) {
50 throw std::runtime_error(
"Value changed!!");
56 [](
int expected,
const IntStruct &in) {
57 std::this_thread::sleep_for(std::chrono::milliseconds(5));
58 if (in.value != expected) {
59 throw std::runtime_error(
"Value changed!!");
62 py::call_guard<py::gil_scoped_release>());
#define TEST_SUBMODULE(name, variable)