I have a Python C-extension that gets data from a socket and processes it, during the processing it releases the GIL. Currently I use 2 Python threads that nicely intertwine due to the GIL-releasing, resulting in 90% load on 2 CPU cores.
How would I achieve the same in Python 3 asyncio? I cannot find the correct Python-C-API command to tell the event-loop that it can go and do something else.
Or put another way: if my extension releases the GIL, does this automatically mean that it will not block the execution of the next item available in the eventloop? E.g. will the next socket be read while my C-extension is processing the data of the first socket? This I cannot find anywhere. From what I understand this way I could get data from a number of sockets and put even more CPU cores to work.