3 ms·
I understand what you are saying, but I don't see how it's relevant? Numpy doesn't rely on the gil, which is why it releases it.
by guipsp 4y ago
I understand what you are saying, but I don't see how it's relevant? Numpy doesn't rely on the gil, which is why it releases it.
- cdavid 4y agoIt releases the GIL only in very specific sections. Most of the Numpy C code runs under the gil. A quick check on master shows only 10-20 calls using NPY_BEGIN_ALLOW_THREADS (which is an alias to Py_BEGIN_ALLOW_THREADS). A lot of the NumPy code manipulates python runtime objects, and doing so without thread safety would likely break everywhere. A lot of efforts would be needed to gradually make large C extension thread safe.