@@ -61,6 +61,9 @@ class Device_manager_cl{
61
61
};
62
62
typedef Device_manager_cl Device_manager;
63
63
64
+ static PyObject *Device_manager_stop (Device_manager *self, PyObject *args);
65
+ static PyObject *Device_manager_close (Device_manager *self, PyObject *args);
66
+
64
67
struct capability {
65
68
int id;
66
69
const char *name;
@@ -205,7 +208,7 @@ static PyObject *Video_device_get_info(Video_device *self)
205
208
206
209
if (!s)
207
210
{
208
- Py_DECREF (set);
211
+ Py_DECREF (set);
209
212
Py_RETURN_NONE;
210
213
}
211
214
@@ -849,6 +852,26 @@ void *Device_manager_Worker_thread(void *arg)
849
852
850
853
static void Device_manager_dealloc (Device_manager *self)
851
854
{
855
+ // Stop high level threads
856
+ for (std::map<std::string, class Device_manager_Worker_thread_args *>::iterator it = self->threadArgStore ->begin ();
857
+ it != self->threadArgStore ->end (); it++)
858
+ {
859
+ PyObject *args = PyTuple_New (1 );
860
+ PyTuple_SetItem (args, 0 , PyString_FromString (it->first .c_str ()));
861
+ Device_manager_stop (self, args);
862
+ Py_DECREF (args);
863
+ }
864
+
865
+ // Close devices
866
+ for (std::map<std::string, int >::iterator it = self->fd ->begin ();
867
+ it != self->fd ->end (); it++)
868
+ {
869
+ PyObject *args = PyTuple_New (1 );
870
+ PyTuple_SetItem (args, 0 , PyString_FromString (it->first .c_str ()));
871
+ Device_manager_close (self, args);
872
+ Py_DECREF (args);
873
+ }
874
+
852
875
delete self->fd ;
853
876
delete self->buffers ;
854
877
delete self->buffer_counts ;
0 commit comments