Bugs item #1432525, was opened at 2006-02-15 17:45 Message generated for change (Comment added) made by jimjjewett You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1432525&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.4 Status: Open Resolution: Accepted Priority: 5 Submitted By: Jonathan Ellis (ellisj) Assigned to: Georg Brandl (gbrandl) Summary: os.listdir doesn't release GIL Initial Comment: posix_listdir in posixmodule.c does not release the global interpreter lock, blocking all other threads for the duration of the call. ---------------------------------------------------------------------- Comment By: Jim Jewett (jimjjewett) Date: 2006-03-07 18:52 Message: Logged In: YES user_id=764593 I think the spaghetti was already there. The gotos can be removed by just reversing the logic (if ! (...)) The XXX comment complains about four versions, but I count either three (windows without opendir, OS2, everything else) or five (the non-OS2 versions are split for unicode). The code getting skipped is repeated because the logic for skipping "." and ".." is repeated four times. (There would be another goto, if the OS2 case allowed threads.) ---------------------------------------------------------------------- Comment By: Jim Jewett (jimjjewett) Date: 2006-03-07 18:48 Message: Logged In: YES user_id=764593 I think the spaghetti was already there. The gotos can be removed by just reversing the logic (if ! (...)) The XXX comment complains about four versions, but I count either three (windows without opendir, OS2, everything else) or five (the non-OS2 versions are split for unicode). The code getting skipped is repeated because the logic for skipping "." and ".." is repeated four times. (There would be another goto, if the OS2 case allowed threads.) ---------------------------------------------------------------------- Comment By: Jonathan Ellis (ellisj) Date: 2006-03-07 17:36 Message: Logged In: YES user_id=657828 My original use case is on a server back end with fairly busy disks. It's not unusual for listdir to take 100ms. That's a relatively long time to shut down the rest of the system. ---------------------------------------------------------------------- Comment By: Guido van Rossum (gvanrossum) Date: 2006-03-07 16:09 Message: Logged In: YES user_id=6380 So the patch is broken because there's a continue in the do-while-loop that jumps to the "while (result)" test without setting result. Fixing this by adding a label and a goto (in two places!) creates awful spaghetti code. Before somebody spends more time refactoring such hairy code, I'd like to see a better motivation; the motivation currently provided is a bit thin. Are there use cases where this call takes a long time? ---------------------------------------------------------------------- Comment By: Georg Brandl (gbrandl) Date: 2006-03-07 07:48 Message: Logged In: YES user_id=849994 Committed as rev. 42884. ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2006-03-03 12:48 Message: Logged In: YES user_id=21627 The patch looks fine. Please apply. ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2006-02-18 06:13 Message: Logged In: YES user_id=1188172 Attaching a patch. Please check. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1432525&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com