Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
3c3829c5
Commit
3c3829c5
authored
Oct 18, 2017
by
sonots
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PythonCompatibility Codes for TSS (Thread Specific Storage) API
parent
07115e3f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+34
-0
No files found.
Cython/Utility/ModuleSetupCode.c
View file @
3c3829c5
...
...
@@ -430,6 +430,40 @@ class __Pyx_FakeReference {
#define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
// TSS (Thread Specific Storage) API
#if PY_VERSION_HEX < 0x03070000 && !defined(PyThread_tss_create)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef
int
Py_tss_t
;
static
CYTHON_INLINE
int
PyThread_tss_create
(
Py_tss_t
*
key
)
{
*
key
=
PyThread_create_key
();
return
0
;
// PyThread_create_key reports success always
}
static
CYTHON_INLINE
Py_tss_t
*
PyThread_tss_alloc
(
void
)
{
Py_tss_t
*
key
=
(
Py_tss_t
*
)
PyObject_Malloc
(
sizeof
(
Py_tss_t
));
*
key
=
Py_tss_NEEDS_INIT
;
return
key
;
}
static
CYTHON_INLINE
void
PyThread_tss_free
(
Py_tss_t
*
key
)
{
PyObject_Free
(
key
);
}
static
CYTHON_INLINE
int
PyThread_tss_is_created
(
Py_tss_t
*
key
)
{
return
*
key
!=
Py_tss_NEEDS_INIT
;
}
static
CYTHON_INLINE
void
PyThread_tss_delete
(
Py_tss_t
*
key
)
{
PyThread_delete_key
(
*
key
);
*
key
=
Py_tss_NEEDS_INIT
;
}
static
CYTHON_INLINE
int
PyThread_tss_set
(
Py_tss_t
*
key
,
void
*
value
)
{
return
PyThread_set_key_value
(
*
key
,
value
);
}
static
CYTHON_INLINE
void
*
PyThread_tss_get
(
Py_tss_t
*
key
)
{
return
PyThread_get_key_value
(
*
key
);
}
// PyThread_delete_key_value(key) is equalivalent to PyThread_set_key_value(key, NULL)
// PyThread_ReInitTLS() is a no-op
#endif // TSS (Thread Specific Storage) API
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment