A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-April/063808.html below:

[Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?

[Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()? [Python-Dev] Py_BEGIN_ALLOW_THREADS around readdir()?Ronald Oussoren ronaldoussoren at mac.com
Mon Apr 17 21:08:27 CEST 2006
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 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.

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.

>
> 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.

Ronald

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4