diff options
author | Sam Gross <colesbury@gmail.com> | 2024-06-21 19:50:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-21 19:50:18 (GMT) |
commit | 8f17d69b7bc906e8407095317842cc0fd52cd84a (patch) | |
tree | 316f24eb7d801391c24e2c0bf8a54bc1a846a1b7 /Include/critical_section.h | |
parent | 03fa2df92707b543c304a426732214002f81d671 (diff) | |
download | cpython-8f17d69b7bc906e8407095317842cc0fd52cd84a.zip cpython-8f17d69b7bc906e8407095317842cc0fd52cd84a.tar.gz cpython-8f17d69b7bc906e8407095317842cc0fd52cd84a.tar.bz2 |
gh-119344: Make critical section API public (#119353)
This makes the following macros public as part of the non-limited C-API for
locking a single object or two objects at once.
* `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()`
* `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()`
The supporting functions and structs used by the macros are also exposed for
cases where C macros are not available.
Diffstat (limited to 'Include/critical_section.h')
-rw-r--r-- | Include/critical_section.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Include/critical_section.h b/Include/critical_section.h new file mode 100644 index 0000000..3b37615 --- /dev/null +++ b/Include/critical_section.h @@ -0,0 +1,16 @@ +#ifndef Py_CRITICAL_SECTION_H +#define Py_CRITICAL_SECTION_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API +# define Py_CPYTHON_CRITICAL_SECTION_H +# include "cpython/critical_section.h" +# undef Py_CPYTHON_CRITICAL_SECTION_H +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CRITICAL_SECTION_H */ |