Py_AtExit(): Added brief note about the constraint on cleanup functions not

calling the Python API.
This commit is contained in:
Fred Drake 1998-01-26 19:16:27 +00:00
parent 25f1722dd7
commit c6c921a4de
2 changed files with 18 additions and 12 deletions

View File

@ -542,12 +542,15 @@ calls the standard \C{} library function \code{exit(0)}.
\end{cfuncdesc} \end{cfuncdesc}
\begin{cfuncdesc}{int}{Py_AtExit}{void (*func) ()} \begin{cfuncdesc}{int}{Py_AtExit}{void (*func) ()}
Register a cleanup function to be called by \code{Py_Finalize()}. The Register a cleanup function to be called by \cfunction{Py_Finalize()}.
cleanup function will be called with no arguments and should return no The cleanup function will be called with no arguments and should
value. At most 32 cleanup functions can be registered. When the return no value. At most 32 cleanup functions can be registered.
registration is successful, \code{Py_AtExit} returns 0; on failure, it When the registration is successful, \cfunction{Py_AtExit()} returns
returns -1. The cleanup function registered last is called first. \code{0}; on failure, it returns \code{-1}. The cleanup function
Each cleanup function will be called at most once. registered last is called first. Each cleanup function will be called
at most once. Since Python's internal finallization will have
completed before the cleanup function, no Python APIs should be called
by \var{func}.
\end{cfuncdesc} \end{cfuncdesc}

View File

@ -542,12 +542,15 @@ calls the standard \C{} library function \code{exit(0)}.
\end{cfuncdesc} \end{cfuncdesc}
\begin{cfuncdesc}{int}{Py_AtExit}{void (*func) ()} \begin{cfuncdesc}{int}{Py_AtExit}{void (*func) ()}
Register a cleanup function to be called by \code{Py_Finalize()}. The Register a cleanup function to be called by \cfunction{Py_Finalize()}.
cleanup function will be called with no arguments and should return no The cleanup function will be called with no arguments and should
value. At most 32 cleanup functions can be registered. When the return no value. At most 32 cleanup functions can be registered.
registration is successful, \code{Py_AtExit} returns 0; on failure, it When the registration is successful, \cfunction{Py_AtExit()} returns
returns -1. The cleanup function registered last is called first. \code{0}; on failure, it returns \code{-1}. The cleanup function
Each cleanup function will be called at most once. registered last is called first. Each cleanup function will be called
at most once. Since Python's internal finallization will have
completed before the cleanup function, no Python APIs should be called
by \var{func}.
\end{cfuncdesc} \end{cfuncdesc}