| 1153 | } |
| 1154 | |
| 1155 | void RedisGearsPy_Lock(PythonExecutionCtx* pectx){ |
| 1156 | PythonThreadCtx* ptctx = GetPythonThreadCtx(); |
| 1157 | |
| 1158 | PythonSessionCtx* oldSession = ptctx->currSession; |
| 1159 | ExecutionCtx* oldEctx = ptctx->currEctx; |
| 1160 | pectx->pyfutureCreated = ptctx->pyfutureCreated; |
| 1161 | |
| 1162 | ptctx->currSession = pectx->sCtx; |
| 1163 | ptctx->currEctx = pectx->eCtx; |
| 1164 | ptctx->pyfutureCreated = NULL; |
| 1165 | |
| 1166 | pectx->sCtx = oldSession; |
| 1167 | pectx->eCtx = oldEctx; |
| 1168 | |
| 1169 | if(ptctx->lockCounter == 0){ |
| 1170 | PyGILState_STATE oldState = PyGILState_Ensure(); |
| 1171 | RedisModule_Assert(oldState == PyGILState_UNLOCKED); |
| 1172 | } |
| 1173 | ++ptctx->lockCounter; |
| 1174 | } |
| 1175 | |
| 1176 | void RedisGearsPy_Unlock(PythonExecutionCtx* oldectx){ |
| 1177 | PythonThreadCtx* ptctx = GetPythonThreadCtx(); |
no test coverage detected