MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _QueryCtx_GetCreateCtx

Function _QueryCtx_GetCreateCtx

src/query_ctx.c:21–37  ·  view source on GitHub ↗

retrieve or instantiate new QueryCtx

Source from the content-addressed store, hash-verified

19
20// retrieve or instantiate new QueryCtx
21static inline QueryCtx *_QueryCtx_GetCreateCtx(void) {
22 QueryCtx *ctx = pthread_getspecific(_tlsQueryCtxKey);
23
24 if(ctx == NULL) {
25 // set a new thread-local QueryCtx if one has not been created
26 ctx = rm_calloc(1, sizeof(QueryCtx));
27
28 // created lazily only when needed
29 ctx->undo_log = NULL;
30 ctx->effects_buffer = NULL;
31 ctx->stage = QueryStage_WAITING; // initial query stage
32
33 pthread_setspecific(_tlsQueryCtxKey, ctx);
34 }
35
36 return ctx;
37}
38
39// retrieve QueryCtx, return NULL if one does not exist
40static inline QueryCtx *_QueryCtx_GetCtx(void) {

Callers 8

QueryCtx_GetQueryCtxFunction · 0.85
QueryCtx_SetASTFunction · 0.85
QueryCtx_SetGraphCtxFunction · 0.85
QueryCtx_SetResultSetFunction · 0.85
QueryCtx_SetParamsFunction · 0.85
QueryCtx_PrintQueryFunction · 0.85
QueryCtx_LockForCommitFunction · 0.85

Calls 1

rm_callocFunction · 0.85

Tested by

no test coverage detected