[Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?

"Martin v. Löwis" martin at v.loewis.de
Mon Apr 17 21:30:21 CEST 2006


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 explicitly says that implementations cannot use a static dirent  
> structure.

Ah, right. I read over this several times, and still managed to
miss that point. Thanks.

>> Of course, the most natural implementation associates the storage
>> for the result with the DIR*, so it's probably not a real problem...
> 
> If this were a problem on some platform I'd expect it to be so  
> ancient that it doesn't offer readdir_r either.

Sure - I would have just removed Py_BEGIN_ALLOW_THREADS on
systems which don't have readdir_r. But this is now unnecessary.

Regards,
Martin


More information about the Python-Dev mailing list