Remove use of the Simplified GIL State API so pylibmc works in sub-interpreters
from commit 74d5f9ac0b
master
parent
725134931b
commit
ddd2f011f7
|
@ -675,15 +675,13 @@ static bool _PylibMC_RunSetCommand(PylibMC_Client* self,
|
|||
_PylibMC_SetCommand f, char *fname,
|
||||
pylibmc_mset* msets, size_t nkeys,
|
||||
size_t min_compress) {
|
||||
PyGILState_STATE gstate;
|
||||
memcached_st* mc = self->mc;
|
||||
memcached_return rc = MEMCACHED_SUCCESS;
|
||||
int pos;
|
||||
bool error = false;
|
||||
bool allsuccess = true;
|
||||
|
||||
gstate = PyGILState_Ensure();
|
||||
PyGILState_Release(gstate);
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
|
||||
for (pos=0; pos < nkeys && !error; pos++) {
|
||||
pylibmc_mset* mset = &msets[pos];
|
||||
|
@ -697,10 +695,8 @@ static bool _PylibMC_RunSetCommand(PylibMC_Client* self,
|
|||
size_t compressed_len = 0;
|
||||
|
||||
if (min_compress && value_len >= min_compress) {
|
||||
gstate = PyGILState_Ensure();
|
||||
_PylibMC_Deflate(value, value_len,
|
||||
&compressed_value, &compressed_len);
|
||||
PyGILState_Release(gstate);
|
||||
}
|
||||
|
||||
if (compressed_value != NULL) {
|
||||
|
@ -749,7 +745,7 @@ static bool _PylibMC_RunSetCommand(PylibMC_Client* self,
|
|||
|
||||
} /* end for each mset */
|
||||
|
||||
gstate = PyGILState_Ensure();
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
/* We only return the last return value, even for a _multi
|
||||
operation, but we do set the success on the mset */
|
||||
|
|
Reference in New Issue