Let's say I have a python script which loads a shared library (SL) through ctypes.
- The SL sets up a
pthread
T1 - The python script configures callbacks through the SL i.e. python script calls functions from the SL with references to python callables
Now, let's say T1 calls a "callback" function, are the following assumptions true:
- the callback function on the Python side is executed within the context of T1
- I can use a queue to communicate between T1 and the Python VM
- I would need to poll the said
queue
on the Python VM side
I understand all the concepts of threading, shared state etc. but I haven't dug very deep on the multi-threading side with Python. Since there is an adaptation layer which I do not know enough at the moment (ctypes), I am afraid I'll be missing some key aspects of the process.