GIL?
Closed this issue · 4 comments
Can you say something about your code and the GIL? Does it release the GIL while doing crypto?
Would be good for multithreaded Python code, so in can use more cores.
this is a simple ctypes wrapper it does not touch the GIL explicitly. do you know of other ctypes wrappers that release the GIL? can you point at good examples?
https://github.com/stef/pysodium/blob/master/pysodium/__init__.py#L33
sodium = ctypes.cdll.LoadLibrary(ctypes.util.find_library('sodium') or \
ctypes.util.find_library('libsodium'))
sodium is of type <CDLL 'libsodium.so.13', handle a8a1e0 at 0x7fa725bcdd30>
on my system, and according to py docs:
https://docs.python.org/3.5/library/ctypes.html#ctypes.CDLL
The Python global interpreter lock is released before calling any function exported by these libraries, and reacquired afterwards.
So this is a non-issue. GIL is released already.
Ah, cool. :)
Maybe this fact could be worth mentioning it in the pysodium docs / README?
excellent contribution! is this also true for py2?