trainman419 / python-cec

Other
171 stars 42 forks source link

cec.init freezes when fails, suggested fix #61

Open robbiepy opened 2 years ago

robbiepy commented 2 years ago

The CEC adapter can only be open by one caller at any one time.

If init() is called when the adapter is already open, the current code is meant to destroy the adapter resource and then raise an exception. However, I found that the code freezes when it attempts to destroy the adapter. CECDestroy(CEC_adapter); CEC_adapter = NULL;

I found the following code fixed it for me: Py_BEGIN_ALLOW_THREADS CECDestroy(CEC_adapter); CEC_adapter = NULL; Py_END_ALLOW_THREADS

trainman419 commented 2 years ago

Ok; I've pushed an updated version to help with this: https://github.com/trainman419/python-cec/commit/227c69b397440eea0d5123d19eecf1ee07c0c008

Please give that a try and let me know if it helps.

robbiepy commented 2 years ago

Ok; I've pushed an updated version to help with this: 227c69b

Please give that a try and let me know if it helps.

Yes that fixes it. Thank you.