summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-03-29 02:24:26 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-03-29 02:24:26 (GMT)
commit174175bf3a5522aa309915a34259bc13685ecf08 (patch)
treef7f8b94f1a67e41e9f005d8dfe3367e8760ec227 /Include
parentaeaec8d4aa6393bdfaab1975fb8e2e059d843a84 (diff)
downloadcpython-174175bf3a5522aa309915a34259bc13685ecf08.zip
cpython-174175bf3a5522aa309915a34259bc13685ecf08.tar.gz
cpython-174175bf3a5522aa309915a34259bc13685ecf08.tar.bz2
Added a comment about the unreferenced PyThreadState.tick_counter
member.
Diffstat (limited to 'Include')
-rw-r--r--Include/pystate.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/Include/pystate.h b/Include/pystate.h
index 353a102..4239108 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -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);