[Python-checkins] python/dist/src/Doc/api init.tex,1.17,1.18
akuchling at users.sourceforge.net
akuchling at users.sourceforge.net
Sat Jul 10 15:42:55 CEST 2004
Update of /cvsroot/python/python/dist/src/Doc/api
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24379
Modified Files:
init.tex
Log Message:
Replace example with simpler alternative using PyGILState_{Ensure,Require). Can someone please confirm this change is OK?
Index: init.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** init.tex 10 Jul 2004 13:31:18 -0000 1.17
--- init.tex 10 Jul 2004 13:42:52 -0000 1.18
***************
*** 471,480 ****
\begin{verbatim}
! PyThreadState *tstate;
! PyObject *result;
!
! /* interp is your reference to an interpreter object. */
! tstate = PyThreadState_New(interp);
! PyEval_AcquireThread(tstate);
/* Perform Python actions here. */
--- 471,476 ----
\begin{verbatim}
! PyGILState_STATE gstate;
! gstate = PyGILState_Ensure();
/* Perform Python actions here. */
***************
*** 483,491 ****
/* Release the thread. No Python API allowed beyond this point. */
! PyEval_ReleaseThread(tstate);
!
! /* You can either delete the thread state, or save it
! until you need it the next time. */
! PyThreadState_Delete(tstate);
\end{verbatim}
--- 479,483 ----
/* Release the thread. No Python API allowed beyond this point. */
! PyGILState_Release(gstate);
\end{verbatim}
***************
*** 728,733 ****
Release any resources previously acquired. After this call, Python's
state will be the same as it was prior to the corresponding
! \cfunction{PyGILState_Ensure} call (but generally this state will be unknown to
! the caller, hence the use of the GILState API.)
Every call to \cfunction{PyGILState_Ensure()} must be matched by a call to
--- 720,725 ----
Release any resources previously acquired. After this call, Python's
state will be the same as it was prior to the corresponding
! \cfunction{PyGILState_Ensure} call (but generally this state will be
! unknown to the caller, hence the use of the GILState API.)
Every call to \cfunction{PyGILState_Ensure()} must be matched by a call to
More information about the Python-checkins
mailing list