-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make _Py_ThreadId()
work on PowerPC, IBM Z, etc.
#112535
Comments
@colesbury Can I take a look at it? |
@corona10 - of course, thanks! |
That's fine. We have many tests preprocessor checks like that, |
Add also test.support.Py_GIL_DISABLED constant.
Add also test.support.Py_GIL_DISABLED constant.
Add also test.support.Py_GIL_DISABLED constant.
Add also test.support.Py_GIL_DISABLED constant.
Add also test.support.Py_GIL_DISABLED constant.
@colesbury Do we need to support more platforms or we can close the issue? |
I think we still want the cross-platform fallback that returns the address of a thread-local variable. That will probably need to be implemented in a |
You may have a look at |
I am going to submit the PR early next week :) |
Update _Py_ThreadId() to support RISC-V
…3084) Update _Py_ThreadId() to support RISC-V
…3185) --------- Co-authored-by: Sam Gross <[email protected]>
Okay, let's close the issue since the fallback implementation is merged. Now, we can support free-threaded CPython for all platforms where the fallback implementation(it only requires thread-local feature) works! |
…ythongh-113185) --------- Co-authored-by: Sam Gross <[email protected]>
Add also test.support.Py_GIL_DISABLED constant.
…3084) Update _Py_ThreadId() to support RISC-V
…ythongh-113185) --------- Co-authored-by: Sam Gross <[email protected]>
See python/cpython#112535 And python/cpython#112624 And python/cpython#112751 Rather than backporting a handful of small commits, let's wait for the next release.
Add also test.support.Py_GIL_DISABLED constant.
…3084) Update _Py_ThreadId() to support RISC-V
…ythongh-113185) --------- Co-authored-by: Sam Gross <[email protected]>
Feature or enhancement
Currently,
_Py_ThreadId()
is only defined inPy_GIL_DISABLED
builds and does not compile on PowerPC or IBM Z. It would be convenient to make the functionality available in general: it will be useful to implement thread-safe recursive locks. (Currently our recursive lock implementations rely on the GIL for thread-safety.)There are two parts to this:
__builtin_thread_pointer()
when availableThe fallback (2) will be a bit slower, but it provides a portable implementation.
Note that checking if
__builtin_thread_pointer()
is available is not trivial.__has_builtin(__builtin_thread_pointer)
is not useful (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96952). You need some combination of platform and GCC/clang version check.cc @vstinner @corona10
Linked PRs
The text was updated successfully, but these errors were encountered: