I'm trying to create a C camera module that python can interact with. The way I envision it working is:
Basically Python will call the C methods to which will pass messages to the C thread. I'll make it thread safe using C mutexes or semaphores to pass the control command over to the C thread.
The question is where do I start the C thread? Is it best to start it in the PyMODINIT_FUNC or should I have another function to start the thread which returns an object holding a reference to the C thread or is there a better simple way? I need something reasonable quick to implement.
Cheers. Mitch.
Ended up just starting the thread in a "start" function and storing the thread id in a static variable and stopping the thread in a "stop" method. Works fine, raises errors where appropriate - no issues.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.