MCPcopy Create free account
hub / github.com/F-Stack/f-stack / AuthAsyncCommand_RedisCommand

Function AuthAsyncCommand_RedisCommand

app/redis-6.2.6/src/modules/helloacl.c:139–156  ·  view source on GitHub ↗

HELLOACL.AUTHASYNC * Asynchronously assigns an ACL user to the current context. */

Source from the content-addressed store, hash-verified

137/* HELLOACL.AUTHASYNC
138 * Asynchronously assigns an ACL user to the current context. */
139int AuthAsyncCommand_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
140 if (argc != 2) return RedisModule_WrongArity(ctx);
141
142 pthread_t tid;
143 RedisModuleBlockedClient *bc = RedisModule_BlockClient(ctx, HelloACL_Reply, HelloACL_Timeout, HelloACL_FreeData, TIMEOUT_TIME);
144
145
146 void **targs = RedisModule_Alloc(sizeof(void*)*2);
147 targs[0] = bc;
148 targs[1] = RedisModule_CreateStringFromString(NULL, argv[1]);
149
150 if (pthread_create(&tid, NULL, HelloACL_ThreadMain, targs) != 0) {
151 RedisModule_AbortBlock(bc);
152 return RedisModule_ReplyWithError(ctx, "-ERR Can't start thread");
153 }
154
155 return REDISMODULE_OK;
156}
157
158/* This function must be present on each Redis module. It is used in order to
159 * register the commands into the Redis server. */

Callers

nothing calls this directly

Calls 1

pthread_createFunction · 0.50

Tested by

no test coverage detected