mirror of
https://github.com/python/cpython.git
synced 2024-11-25 19:03:49 +08:00
Added a comment about the unreferenced PyThreadState.tick_counter
member.
This commit is contained in:
parent
aeaec8d4aa
commit
174175bf3a
@ -74,7 +74,14 @@ typedef struct _ts {
|
||||
|
||||
PyObject *dict;
|
||||
|
||||
/* tick_counter is incremented whenever the check_interval ticker
|
||||
* reaches zero. The purpose is to give a useful measure of the number
|
||||
* of interpreted bytecode instructions in a given thread. This
|
||||
* extremely lightweight statistic collector may be of interest to
|
||||
* profilers (like psyco.jit()), although nothing in the core uses it.
|
||||
*/
|
||||
int tick_counter;
|
||||
|
||||
int gilstate_counter;
|
||||
|
||||
PyObject *async_exc; /* Asynchronous exception to raise */
|
||||
@ -112,16 +119,16 @@ PyAPI_DATA(PyThreadState *) _PyThreadState_Current;
|
||||
#define PyThreadState_GET() (_PyThreadState_Current)
|
||||
#endif
|
||||
|
||||
typedef
|
||||
typedef
|
||||
enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
|
||||
PyGILState_STATE;
|
||||
|
||||
/* Ensure that the current thread is ready to call the Python
|
||||
C API, regardless of the current state of Python, or of its
|
||||
thread lock. This may be called as many times as desired
|
||||
by a thread so long as each call is matched with a call to
|
||||
PyGILState_Release(). In general, other thread-state APIs may
|
||||
be used between _Ensure() and _Release() calls, so long as the
|
||||
by a thread so long as each call is matched with a call to
|
||||
PyGILState_Release(). In general, other thread-state APIs may
|
||||
be used between _Ensure() and _Release() calls, so long as the
|
||||
thread-state is restored to its previous state before the Release().
|
||||
For example, normal use of the Py_BEGIN_ALLOW_THREADS/
|
||||
Py_END_ALLOW_THREADS macros are acceptable.
|
||||
@ -129,8 +136,8 @@ typedef
|
||||
The return value is an opaque "handle" to the thread state when
|
||||
PyGILState_Ensure() was called, and must be passed to
|
||||
PyGILState_Release() to ensure Python is left in the same state. Even
|
||||
though recursive calls are allowed, these handles can *not* be shared -
|
||||
each unique call to PyGILState_Ensure must save the handle for its
|
||||
though recursive calls are allowed, these handles can *not* be shared -
|
||||
each unique call to PyGILState_Ensure must save the handle for its
|
||||
call to PyGILState_Release.
|
||||
|
||||
When the function returns, the current thread will hold the GIL.
|
||||
@ -141,18 +148,18 @@ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
|
||||
|
||||
/* Release any resources previously acquired. After this call, Python's
|
||||
state will be the same as it was prior to the corresponding
|
||||
PyGILState_Ensure() call (but generally this state will be unknown to
|
||||
PyGILState_Ensure() call (but generally this state will be unknown to
|
||||
the caller, hence the use of the GILState API.)
|
||||
|
||||
Every call to PyGILState_Ensure must be matched by a call to
|
||||
Every call to PyGILState_Ensure must be matched by a call to
|
||||
PyGILState_Release on the same thread.
|
||||
*/
|
||||
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
|
||||
|
||||
/* Helper/diagnostic function - get the current thread state for
|
||||
this thread. May return NULL if no GILState API has been used
|
||||
on the current thread. Note the main thread always has such a
|
||||
thread-state, even if no auto-thread-state call has been made
|
||||
this thread. May return NULL if no GILState API has been used
|
||||
on the current thread. Note the main thread always has such a
|
||||
thread-state, even if no auto-thread-state call has been made
|
||||
on the main thread.
|
||||
*/
|
||||
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
|
||||
|
Loading…
Reference in New Issue
Block a user