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

Function Globals_TrackCommandCtx

src/globals.c:197–220  ·  view source on GitHub ↗

track CommandCtx

Source from the content-addressed store, hash-verified

195
196// track CommandCtx
197void Globals_TrackCommandCtx
198(
199 CommandCtx *ctx // CommandCtx to track
200) {
201 ASSERT(ctx != NULL);
202 ASSERT(_globals.command_ctxs != NULL);
203
204 int tid = ThreadPools_GetThreadID();
205
206 // acuire read lock
207 pthread_rwlock_rdlock(&_globals.lock);
208
209 // expecting slot to be empty
210 ASSERT(_globals.command_ctxs[tid] == NULL);
211
212 // set ctx at the current thread entry
213 _globals.command_ctxs[tid] = ctx;
214
215 // release lock
216 pthread_rwlock_unlock(&_globals.lock);
217
218 // reset thread memory consumption to 0 (no memory consumed)
219 rm_reset_n_alloced();
220}
221
222// untrack CommandCtx
223void Globals_UntrackCommandCtx

Callers 3

_ExecuteQueryFunction · 0.85
_queryFunction · 0.85
Graph_ExplainFunction · 0.85

Calls 2

ThreadPools_GetThreadIDFunction · 0.85
rm_reset_n_allocedFunction · 0.85

Tested by

no test coverage detected