@@ -20,23 +20,23 @@ extern "C" {
2020// transitions between "attached" and "detached" on its own PyThreadState.
2121//
2222// The "suspended" state is used to implement stop-the-world pauses, such as
23- // for cyclic garbage collection. It is only used in `--disable-gil` builds. It
24- // is similar to the "detached" state, but only the thread performing a
25- // stop- the-world pause may transition a thread from the "suspended" state back
26- // to the "detached" state. A thread trying to "attach" from the "suspended"
27- // state will block until it is transitioned back to "detached" when the
28- // stop- the-world pause is complete .
23+ // for cyclic garbage collection. It is only used in `--disable-gil` builds.
24+ // The "suspended" state is similar to the "detached" state in that in both
25+ // states the thread is not allowed to call most Python APIs. However, unlike
26+ // the "detached" state, a thread may not transition itself out from the
27+ // "suspended" state. Only the thread performing a stop-the-world pause may
28+ // transition a thread from the "suspended" state back to the "detached" state .
2929//
3030// State transition diagram:
3131//
3232// (bound thread) (stop-the-world thread)
3333// [attached] <-> [detached] <-> [suspended]
34- // + ^
35- // +----------------------------- ---------------------------+
34+ // | ^
35+ // +----------------------------> ---------------------------+
3636// (bound thread)
3737//
38- // See `_PyThreadState_Attach()`, `_PyThreadState_Detach()`, and
39- // `_PyThreadState_Suspend()` .
38+ // The (bound thread) and (stop-the-world thread) labels indicate which thread
39+ // is allowed to perform the transition .
4040#define _Py_THREAD_DETACHED 0
4141#define _Py_THREAD_ATTACHED 1
4242#define _Py_THREAD_SUSPENDED 2
@@ -153,10 +153,9 @@ extern void _PyThreadState_Detach(PyThreadState *tstate);
153153// Detaches the current thread to the "suspended" state if a stop-the-world
154154// pause is in progress.
155155//
156- // If there is no stop-the-world pause in progress, then this function is
157- // a no-op. Returns one if the thread was switched to the "suspended" state and
158- // zero otherwise.
159- extern int _PyThreadState_Suspend (PyThreadState * tstate );
156+ // If there is no stop-the-world pause in progress, then the thread switches
157+ // to the "detached" state.
158+ extern void _PyThreadState_Suspend (PyThreadState * tstate );
160159
161160// Perform a stop-the-world pause for all threads in the all interpreters.
162161//
0 commit comments