Skip to content

Commit e922c6e

Browse files
committed
Move API declarations to Include/cpython
1 parent 6c594ce commit e922c6e

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

Include/cpython/pythread.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
# error "this header file must not be included directly"
33
#endif
44

5+
/* Thread joining APIs.
6+
*
7+
* These APIs have a strict contract:
8+
* - Either PyThread_join_thread or PyThread_detach_thread must be called
9+
* exactly once with the given handle.
10+
* - Calling neither PyThread_join_thread nor PyThread_detach_thread results
11+
* in a resource leak until the end of the process.
12+
* - Any other usage, such as calling both PyThread_join_thread and
13+
* PyThread_detach_thread, or calling them more than once (including
14+
* simultaneously), results in undefined behavior.
15+
*/
16+
PyAPI_FUNC(unsigned long) PyThread_start_joinable_thread(void (*func)(void *),
17+
void *arg,
18+
Py_uintptr_t* handle);
19+
PyAPI_FUNC(int) PyThread_join_thread(Py_uintptr_t);
20+
PyAPI_FUNC(int) PyThread_detach_thread(Py_uintptr_t);
21+
522
// PY_TIMEOUT_MAX is the highest usable value (in microseconds) of PY_TIMEOUT_T
623
// type, and depends on the system threading API.
724
//

Include/pythread.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,6 @@ PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *);
2020
PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
2121
PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void);
2222

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-
*/
35-
PyAPI_FUNC(unsigned long) PyThread_start_joinable_thread(void (*func)(void *),
36-
void *arg,
37-
Py_uintptr_t* handle);
38-
PyAPI_FUNC(int) PyThread_join_thread(Py_uintptr_t);
39-
PyAPI_FUNC(int) PyThread_detach_thread(Py_uintptr_t);
40-
#endif
41-
4223
#if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \
4324
|| defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
4425
|| defined(__DragonFly__) || defined(_AIX))

0 commit comments

Comments
 (0)