[Python-Dev] PyOS_AfterFork() (was: CVS: python/dist/src/Doc/api api.tex,1.68,1.69)

Greg Stein gstein@lyra.org
Wed, 28 Jun 2000 14:14:41 -0700


Woah. Never knew this was in Python.

It is quite interesting, as there is a very similar concept within Apache.
In that model, you register a cleanup function for the particular data that
needs to be cleaned post-fork. After the fork occurs, the cleanups are
called.

In essence, Python would register PyOS_AfterFork. Of course, any schmoe can
call fork() and avoid the cleanups, so it bungs up the whole scheme. In
Apache, the "only" way to fork is to call an APR function, which guarantees
the cleanups.

Cheers,
-g

On Wed, Jun 28, 2000 at 08:53:17AM -0700, Fred L. Drake wrote:
> Update of /cvsroot/python/python/dist/src/Doc/api
> In directory slayer.i.sourceforge.net:/tmp/cvs-serv11228/api
> 
> Modified Files:
> 	api.tex 
> Log Message:
> 
> Added documentation for PyOS_AfterFork().
> 
> 
> Index: api.tex
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v
> retrieving revision 1.68
> retrieving revision 1.69
> diff -C2 -r1.68 -r1.69
> *** api.tex	2000/06/18 05:21:21	1.68
> --- api.tex	2000/06/28 15:53:13	1.69
> ***************
> *** 1034,1037 ****
> --- 1034,1044 ----
>   \end{cfuncdesc}
>   
> + \begin{cfuncdesc}{void}{PyOS_AfterFork}{}
> + Function to update some internal state after a process fork; this
> + should be called in the new process if the Python interpreter will
> + continue to be used.  If a new executable is loaded into the new
> + process, this function does not need to be called.
> + \end{cfuncdesc}
> + 
>   
>   \section{Process Control \label{processControl}}
> 
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://www.python.org/mailman/listinfo/python-checkins

-- 
Greg Stein, http://www.lyra.org/