[Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()? (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Mon Apr 17 20:50:32 CEST 2006


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 need not be reentrant."

which seems to allow for an implementation that returns a static struct dirent.

Of course, the most natural implementation associates the storage for the result with the DIR*, so it's probably not a real problem...

Regards, Martin



More information about the Python-Dev mailing list