Skip to content

Commit

Permalink
Add note explicitly recommending PyMutex over PyThread_type_lock (#72)
Browse files Browse the repository at this point in the history
Needed because the linked NumPy PR uses `PyThread_type_lock`. Also link
to the PR that replaced that with `PyMutex`.
  • Loading branch information
lysnikolaou authored Sep 4, 2024
1 parent 2f194c4 commit 85922f1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ int function_accessing_the_cache(void) {

```
!!! note
Note that, while the NumPy PR linked above uses `PyThread_type_lock`, that is
only because `PyMutex` was not part of the public Python C API at the time. We
recommended always using `PyMutex`. For pointers on how to do that, check
[this NumPy PR](https://github.com/numpy/numpy/pull/27011) that ports all
`PyThread_type_lock` usages to `PyMutex`.
### Dealing with thread-unsafe libraries
Many C, C++, and Fortran libraries are not written in a thread-safe manner. It
Expand Down

0 comments on commit 85922f1

Please sign in to comment.