mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Removed obsolete comments about confused string refcount tricks (Jeremy
removed the tricks). Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a new block is neither necessary nor helpful).
This commit is contained in:
parent
2a2d970ef9
commit
6605c64c83
1 changed files with 4 additions and 9 deletions
|
|
@ -23,11 +23,6 @@
|
||||||
time-consuming functions where we need to worry about holding up
|
time-consuming functions where we need to worry about holding up
|
||||||
other Python threads.
|
other Python threads.
|
||||||
|
|
||||||
We don't need to worry about the string inputs being modified out
|
|
||||||
from underneath us, because string objects are immutable. However,
|
|
||||||
we do need to make sure we take on ownership, so that the strings
|
|
||||||
are not deleted out from under us during a thread swap.
|
|
||||||
|
|
||||||
N.B.
|
N.B.
|
||||||
|
|
||||||
Since ENTER_ZLIB and LEAVE_ZLIB only need to be called on functions
|
Since ENTER_ZLIB and LEAVE_ZLIB only need to be called on functions
|
||||||
|
|
@ -36,17 +31,17 @@
|
||||||
there was an de/compress object-specific lock. However, for the
|
there was an de/compress object-specific lock. However, for the
|
||||||
moment the ENTER_ZLIB and LEAVE_ZLIB calls are global for ALL
|
moment the ENTER_ZLIB and LEAVE_ZLIB calls are global for ALL
|
||||||
de/compress objects.
|
de/compress objects.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static PyThread_type_lock zlib_lock = NULL; /* initialized on module load */
|
static PyThread_type_lock zlib_lock = NULL; /* initialized on module load */
|
||||||
|
|
||||||
#define ENTER_ZLIB \
|
#define ENTER_ZLIB \
|
||||||
{ Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(zlib_lock, 1); \
|
Py_BEGIN_ALLOW_THREADS \
|
||||||
Py_END_ALLOW_THREADS
|
PyThread_acquire_lock(zlib_lock, 1); \
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
#define LEAVE_ZLIB \
|
#define LEAVE_ZLIB \
|
||||||
PyThread_release_lock(zlib_lock); }
|
PyThread_release_lock(zlib_lock);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue