[EMAIL PROTECTED] wrote:
Hi David,

Thanks for the bit of code on finding shares! I'd been using something a
bit different (win32com.client stuff) but your code looks better.


I've found that "win32file.FindFilesIterator" (suggested to me by another
person on this mailing list) allows the gui to remain responsive. Using the
same code to execute the "os.listdir" hangs the gui!

It's conceivable that os.listdir hangs on to the GIL while making the relevant system call. This would prevent any other Python threads from executing until the call was complete.


A check of the source code confirms that interpretation - listdir calls into the Python API as it constructs the list of names, so it needs to hold the GIL for those calls. It may be possible to modify the function so that the GIL isn't held during the system calls, but that would require a bit of work (given what a tangle of ifdef's the function is).

The relevant file is dist/src/Modules/posixmodule.c and the relevant function is posix_listdir.

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to