Similar to RM_ThreadSafeContextLock but this function * would not block if the server lock is already acquired. * * If successful (lock acquired) REDISMODULE_OK is returned, * otherwise REDISMODULE_ERR is returned and errno is set * accordingly. */
| 5946 | * otherwise REDISMODULE_ERR is returned and errno is set |
| 5947 | * accordingly. */ |
| 5948 | int RM_ThreadSafeContextTryLock(RedisModuleCtx *ctx) { |
| 5949 | UNUSED(ctx); |
| 5950 | |
| 5951 | int res = moduleTryAcquireGIL(false /*fServerThread*/, true /*fExclusive*/); |
| 5952 | if(res != 0) { |
| 5953 | errno = res; |
| 5954 | return REDISMODULE_ERR; |
| 5955 | } |
| 5956 | return REDISMODULE_OK; |
| 5957 | } |
| 5958 | |
| 5959 | /* Release the server lock after a thread safe API call was executed. */ |
| 5960 | void RM_ThreadSafeContextUnlock(RedisModuleCtx *ctx) { |
nothing calls this directly
no test coverage detected