[Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?

2006-04-17 Thread Martin v. Löwis
Currently, the readdir() call releases the GIL. I believe this is not thread-safe, because readdir() does not need to be re-entrant; we should use readdir_r where available to get a thread-safe version. Comments? Regards, Martin ___ Python-Dev mailing

Re: [Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?

2006-04-17 Thread Martin v. Löwis
Ronald Oussoren wrote: AFAIK readdir is only unsafe when multiple threads use the same DIR* at the same time. The spec[1] seems to agree with me. [1] : http://www.opengroup.org/onlinepubs/009695399/functions/readdir.html What specific sentence makes you think so? I see The readdir() interface

Re: [Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?

2006-04-17 Thread Ronald Oussoren
On 17-apr-2006, at 20:50, Martin v. Löwis wrote: Ronald Oussoren wrote: AFAIK readdir is only unsafe when multiple threads use the same DIR* at the same time. The spec[1] seems to agree with me. [1] : http://www.opengroup.org/onlinepubs/009695399/functions/ readdir.html What specific

Re: [Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?

2006-04-17 Thread Martin v. Löwis
Ronald Oussoren wrote: A couple of lines down it says: The pointer returned by readdir() points to data which may be overwritten by another call to readdir() on the same directory stream. This data is not overwritten by another call to readdir() on a different directory stream. This