mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
`find` can be a time consuming routine when it broadcasts for devices and there are a lot of them in your network. We therefore have to release the GIL before calling into find because otherwise the GIL would be locked until `find` returns.
25 lines
584 B
C++
25 lines
584 B
C++
//
|
|
// Copyright 2020 Ettus Research, a National Instruments Brand
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
//
|
|
|
|
#include <pybind11/complex.h>
|
|
#include <pybind11/pybind11.h>
|
|
#include <pybind11/stl.h>
|
|
|
|
namespace py = pybind11;
|
|
|
|
#include "device_python.hpp"
|
|
#include <uhd/device.hpp>
|
|
|
|
void export_device(py::module& m)
|
|
{
|
|
m.def("find", [](const uhd::device_addr_t& hint) {
|
|
// release the GIL before calling into find.
|
|
// otherwise find would block any other Python thread
|
|
py::gil_scoped_release release;
|
|
return uhd::device::find(hint);
|
|
});
|
|
}
|