Commit 10239ec8 authored by Tim Peters's avatar Tim Peters

Added a comment about the unreferenced PyThreadState.tick_counter

member.
parent b387d9a4
...@@ -74,7 +74,14 @@ typedef struct _ts { ...@@ -74,7 +74,14 @@ typedef struct _ts {
PyObject *dict; 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 tick_counter;
int gilstate_counter; int gilstate_counter;
PyObject *async_exc; /* Asynchronous exception to raise */ PyObject *async_exc; /* Asynchronous exception to raise */
...@@ -112,16 +119,16 @@ PyAPI_DATA(PyThreadState *) _PyThreadState_Current; ...@@ -112,16 +119,16 @@ PyAPI_DATA(PyThreadState *) _PyThreadState_Current;
#define PyThreadState_GET() (_PyThreadState_Current) #define PyThreadState_GET() (_PyThreadState_Current)
#endif #endif
typedef typedef
enum {PyGILState_LOCKED, PyGILState_UNLOCKED} enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
PyGILState_STATE; PyGILState_STATE;
/* Ensure that the current thread is ready to call the Python /* Ensure that the current thread is ready to call the Python
C API, regardless of the current state of Python, or of its C API, regardless of the current state of Python, or of its
thread lock. This may be called as many times as desired 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 by a thread so long as each call is matched with a call to
PyGILState_Release(). In general, other thread-state APIs may PyGILState_Release(). In general, other thread-state APIs may
be used between _Ensure() and _Release() calls, so long as the be used between _Ensure() and _Release() calls, so long as the
thread-state is restored to its previous state before the Release(). thread-state is restored to its previous state before the Release().
For example, normal use of the Py_BEGIN_ALLOW_THREADS/ For example, normal use of the Py_BEGIN_ALLOW_THREADS/
Py_END_ALLOW_THREADS macros are acceptable. Py_END_ALLOW_THREADS macros are acceptable.
...@@ -129,8 +136,8 @@ typedef ...@@ -129,8 +136,8 @@ typedef
The return value is an opaque "handle" to the thread state when The return value is an opaque "handle" to the thread state when
PyGILState_Ensure() was called, and must be passed to PyGILState_Ensure() was called, and must be passed to
PyGILState_Release() to ensure Python is left in the same state. Even PyGILState_Release() to ensure Python is left in the same state. Even
though recursive calls are allowed, these handles can *not* be shared - though recursive calls are allowed, these handles can *not* be shared -
each unique call to PyGILState_Ensure must save the handle for its each unique call to PyGILState_Ensure must save the handle for its
call to PyGILState_Release. call to PyGILState_Release.
When the function returns, the current thread will hold the GIL. When the function returns, the current thread will hold the GIL.
...@@ -141,18 +148,18 @@ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); ...@@ -141,18 +148,18 @@ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
/* Release any resources previously acquired. After this call, Python's /* Release any resources previously acquired. After this call, Python's
state will be the same as it was prior to the corresponding 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.) 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. PyGILState_Release on the same thread.
*/ */
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
/* Helper/diagnostic function - get the current thread state for /* Helper/diagnostic function - get the current thread state for
this thread. May return NULL if no GILState API has been used this thread. May return NULL if no GILState API has been used
on the current thread. Note the main thread always has such a on the current thread. Note the main thread always has such a
thread-state, even if no auto-thread-state call has been made thread-state, even if no auto-thread-state call has been made
on the main thread. on the main thread.
*/ */
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment