MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / RedisGearsPy_Lock

Function RedisGearsPy_Lock

plugins/python/redisgears_python.c:1155–1174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1153}
1154
1155void 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
1176void RedisGearsPy_Unlock(PythonExecutionCtx* oldectx){
1177 PythonThreadCtx* ptctx = GetPythonThreadCtx();

Calls 1

GetPythonThreadCtxFunction · 0.85

Tested by

no test coverage detected