#3 pycap doesn't release the GIL

open
nobody
None
5
2010-06-06
2010-06-06
Nikola Dyundev
No

pycap does not release the GIL and thus if the pycap.capture call is called inside a thread, the whole program is stuck while executing the thread. I've done a small change in the code so that the GIL is released while waiting for a package. The change starts from line 115 of the capture.c file. Here is the cnaged piece of code:
Py_BEGIN_ALLOW_THREADS;
packet = (u_char *) pcap_next(self->pcap, &header);
Py_END_ALLOW_THREADS;

You can find the changed file applied to this description

Discussion

  • Nikola Dyundev
    Nikola Dyundev
    2010-06-06

    capture.c changed to release the GIL

     
    Attachments