Detaching a thread started from function called in Python #5065
Unanswered
jacopoabramo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Howdy, I'm getting started to use
pybind11
for a project that involves controlling a camera that should stream data to disk while being able to interface via a Python application. The camera I'm currently working on supports multithreading when it comes to retrieving images from the queue (created by the camera library in the background), so my idea was to spawn a thread from a Python call, detaching it and then using mutexes to keep track of the ongoing operation.I'm more interested on the first problem: is it safe to call from Python a function that detaches a thread?
Minimal example:
And then in python it would be something like:
I tested this locally and it seems to work, but considering the disclaimer related to the GIL in the Python documentation I'm afraid I may not see a future problem when related to what I want to achieve.
Beta Was this translation helpful? Give feedback.
All reactions