waste of resources ?

Moshe Zadka moshez at math.huji.ac.il
Mon Jun 7 18:03:03 EDT 1999

On 7 Jun 1999, Hrvoje Niksic wrote:

<about syscalls throwing EINTR and aborting>
> I don't know about Perl, but a good fix would be to have the
> interpreter do the hard work for us.  If a system call fails and errno 
> is EINTR, then the signal handler should be called, *and* the syscall
> should be restarted.


You can do the hard-work yourself, but once and for all:

def myread(file):
	while 1:
			return file.read()
		except (IOError, os.error), detail:
			if detail.args[0] != errno.EINTR: raise

And just call myread(foo) instead of  foo.read(). 
Where's the catch-22?
Moshe Zadka <mzadka at geocities.com>. 
QOTD: My own exit is more likely to be horizontal then perpendicular.

More information about the Python-list mailing list