File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,17 @@ PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
21
21
PyAPI_FUNC (unsigned long ) PyThread_get_thread_ident (void );
22
22
23
23
#if !defined(Py_LIMITED_API )
24
+ /* Thread joining APIs.
25
+ *
26
+ * These APIs have a strict contract:
27
+ * - Either PyThread_join_thread or PyThread_detach_thread must be called
28
+ * exactly once with the given handle.
29
+ * - Calling neither PyThread_join_thread nor PyThread_detach_thread results
30
+ * in a resource leak until the end of the process.
31
+ * - Any other usage, such as calling both PyThread_join_thread and
32
+ * PyThread_detach_thread, or calling them more than once (including
33
+ * simultaneously), results in undefined behavior.
34
+ */
24
35
PyAPI_FUNC (unsigned long ) PyThread_start_joinable_thread (void (* func )(void * ),
25
36
void * arg ,
26
37
Py_uintptr_t * handle );
Original file line number Diff line number Diff line change @@ -1280,12 +1280,18 @@ PyDoc_STRVAR(start_new_doc,
1280
1280
"start_new_thread(function, args[, kwargs[, joinable]])\n\
1281
1281
(start_new() is an obsolete synonym)\n\
1282
1282
\n\
1283
- Start a new thread and return its identifier. The thread will call the\n\
1284
- function with positional arguments from the tuple args and keyword arguments\n\
1285
- taken from the optional dictionary kwargs. The thread exits when the\n\
1286
- function returns; the return value is ignored. The thread will also exit\n\
1287
- when the function raises an unhandled exception; a stack trace will be\n\
1288
- printed unless the exception is SystemExit.\n" );
1283
+ Start a new thread and return its identifier.\n\
1284
+ \n\
1285
+ The thread will call the function with positional arguments from the\n\
1286
+ tuple args and keyword arguments taken from the optional dictionary\n\
1287
+ kwargs. The thread exits when the function returns; the return value\n\
1288
+ is ignored. The thread will also exit when the function raises an\n\
1289
+ unhandled exception; a stack trace will be printed unless the exception\n\
1290
+ is SystemExit.\n\
1291
+ If the optional joinable argument is True, then the thread must later\n\
1292
+ be joined with join_thread() or detached with detach_thread().\n\
1293
+ Failure to do so results in a system resource leak until interpreter\n\
1294
+ shutdown.\n" );
1289
1295
1290
1296
static PyObject *
1291
1297
thread_PyThread_exit_thread (PyObject * self , PyObject * Py_UNUSED (ignored ))
You can’t perform that action at this time.
0 commit comments