MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / ImplStream_HoldResources

Function ImplStream_HoldResources

python/mod_cvcuda/nvcv/CAPI.cpp:154–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154extern "C" void ImplStream_HoldResources(PyObject *stream, PyObject *resourceList)
155{
156 try
157 {
158 py::list resList = ToObj<py::list>(resourceList);
159
160 LockResources resVector;
161
162 for (py::handle h : resList)
163 {
164 py::tuple t = h.cast<py::tuple>();
165 if (t.size() != 2)
166 {
167 throw std::runtime_error("ResourcePerMode tuple must have two elements");
168 }
169
170 auto lockMode = ToLockMode(t[0].ptr());
171 auto res = ToSharedObj<const Resource>(t[1].ptr());
172
173 resVector.emplace(lockMode, res);
174 }
175
176 ToSharedObj<Stream>(stream)->holdResources(std::move(resVector));
177 }
178 CATCH_RETURN_DEFAULT(, "Hold resources failed")
179}
180
181extern "C" PyObject *ImplStream_GetCurrent()
182{

Callers

nothing calls this directly

Calls 5

ToLockModeFunction · 0.85
holdResourcesMethod · 0.80
sizeMethod · 0.45
ptrMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected