diff --git a/source/include/signalflow/core/util.h b/source/include/signalflow/core/util.h index 15d683ec..d3992ba0 100644 --- a/source/include/signalflow/core/util.h +++ b/source/include/signalflow/core/util.h @@ -18,6 +18,7 @@ namespace signalflow { double signalflow_timestamp(); +void signalflow_msleep(int millis); long signalflow_create_random_seed(); double signalflow_clip(double value, double min, double max); diff --git a/source/src/core/util.cpp b/source/src/core/util.cpp index 92caf3e5..7ba9c878 100644 --- a/source/src/core/util.cpp +++ b/source/src/core/util.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace signalflow { @@ -28,6 +29,11 @@ double signalflow_timestamp() / 1000000.0; } +void signalflow_msleep(int millis) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(millis)); +} + long signalflow_create_random_seed() { /*--------------------------------------------------------------------* diff --git a/source/src/python/graph.cpp b/source/src/python/graph.cpp index a1c62ca8..b08cb540 100644 --- a/source/src/python/graph.cpp +++ b/source/src/python/graph.cpp @@ -159,7 +159,7 @@ void init_python_graph(py::module &m) *-------------------------------------------------------------------------------*/ py::gil_scoped_release release; - std::this_thread::sleep_for(std::chrono::milliseconds(5)); + signalflow_msleep(5); if (graph.has_raised_audio_thread_error()) break; @@ -188,7 +188,7 @@ void init_python_graph(py::module &m) *-------------------------------------------------------------------------------*/ py::gil_scoped_release release; - std::this_thread::sleep_for(std::chrono::milliseconds(5)); + signalflow_msleep(5); if (graph.has_raised_audio_thread_error()) break;