close(), exceptions and problems
Erwin S. Andreasen
erwin at andreasen.com
Sun Mar 25 12:04:36 EST 2001
On 24 Mar 2001 16:22:43 GMT, Marcin 'Qrczak' Kowalczyk wrote:
>Sat, 24 Mar 2001 12:23:03 +0000 (UTC), Erwin S. Andreasen <erwin at andreasen.com> pisze:
>
>> But if you call close(fd) you aren't supposed to do something like:
>>
>> int fd, rv;
>> while (((rv = close(fd)) < 0 && errno == EINTR))
>> ;
>> if (rv < 0)
>> perror("close");
>
>Linux documentation says otherwise.
That's GNU libc documentation actually.
> `EINTR'
> The `close' call was interrupted by a signal. *Note
> Interrupted Primitives::. Here is an example of how to
> handle `EINTR' properly:
>
> TEMP_FAILURE_RETRY (close (desc));
But this only happens when SA_RESTART is not set (OK, I thought it was
SA_NORESTART to *disable* restarting but it's SA_RESTART to enable
restarting).
Read the "Interrupted Primitives" node for more information.
Maybe the threading library on the platform the original poster uses does not
set the SA_RESTART flag (if its threads are userspace, switched by receiving
SIUGUSR1) ? But that's hard to believe.
--
=======================================================================
<erwin at andreasen.com> Herlev, Denmark Software Designer
<URL:http://www.andreasen.org/> <*> LASAT^WEicon Networks
=======================================================================
More information about the Python-list
mailing list