Fast way to send message between 2 child processes? (using a file is too slow?)

Andrew Bennetts andrew-pythonlist at puzzling.org
Tue Mar 9 21:49:03 EST 2004


On Tue, Mar 09, 2004 at 08:41:05PM -0600, Jeff Epler wrote:
[...]
> > >         for j in range(3, 255):
> > >             try: os.close(j)
> > >             except: pass
> > 
> > What is purpose of this part?
> 
> This closes any files open in the parent process which should not be
> available in the child.  Instead of the hardcoded value 255, it should
> probably be os.sysconf("SC_OPEN_MAX"). (see the manpage for sysconf)

Oh!  I didn't know about os.sysconf... I wonder if that's better or worse
than resource.getrlimit(resource.RLIMIT_NOFILE)?

-Andrew.





More information about the Python-list mailing list