Return a detached thread safe context that is not associated with any * specific blocked client, but is associated with the module's context. * * This is useful for modules that wish to hold a global context over * a long term, for purposes such as logging. */
| 5786 | * This is useful for modules that wish to hold a global context over |
| 5787 | * a long term, for purposes such as logging. */ |
| 5788 | RedisModuleCtx *RM_GetDetachedThreadSafeContext(RedisModuleCtx *ctx) { |
| 5789 | RedisModuleCtx *new_ctx = zmalloc(sizeof(*new_ctx)); |
| 5790 | RedisModuleCtx empty = REDISMODULE_CTX_INIT; |
| 5791 | memcpy(new_ctx,&empty,sizeof(empty)); |
| 5792 | new_ctx->module = ctx->module; |
| 5793 | new_ctx->flags |= REDISMODULE_CTX_THREAD_SAFE; |
| 5794 | new_ctx->client = createClient(NULL); |
| 5795 | return new_ctx; |
| 5796 | } |
| 5797 | |
| 5798 | /* Release a thread safe context. */ |
| 5799 | void RM_FreeThreadSafeContext(RedisModuleCtx *ctx) { |
nothing calls this directly
no test coverage detected