trainman419 / python-cec

Other
170 stars 42 forks source link

Implemented cec.close() #64

Closed jonathancyu closed 1 year ago

jonathancyu commented 1 year ago

I found that killing the process or finishing the script locks out this library from further use in other scripts, as well as the cec-utils command line utility.

jonathancyu commented 1 year ago

I would squash commits btw :)

trainman419 commented 1 year ago

Thanks! Would you mind updating the readme as well?

jonathancyu commented 1 year ago

TODO: change back destroyAdapter to avoid nesting of Py_BEGIN_ALLOW_THREADS

jonathancyu commented 1 year ago

I changed the description on the readme, added cec.close() to cb_test.py, and also took out destroy_adapter - I don't think destroying the adapter is desired, and calling functions after close() will segfault.

One thing to note is that

cec.init()
cec.close()
cec.init()

will hang on the last init(), so this'll break code that closes and opens the adapters.

trainman419 commented 1 year ago

will hang on the last init(), so this'll break code that closes and opens the adapters.

It wasn't even possible to close and reopen the adapter before, so I don't think this is a big issue.

Thank you for implementing this!