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

Function GraphContext_DecreaseRefCount

src/graph/graphcontext.c:59–82  ·  view source on GitHub ↗

decrease graph context ref count by 1

Source from the content-addressed store, hash-verified

57
58// decrease graph context ref count by 1
59inline void GraphContext_DecreaseRefCount
60(
61 GraphContext *gc
62) {
63 ASSERT(gc != NULL);
64
65 // if the reference count is 0
66 // the graph has been marked for deletion and no queries are active
67 // free the graph
68 if(__atomic_sub_fetch(&gc->ref_count, 1, __ATOMIC_RELAXED) == 0) {
69 bool async_delete;
70 Config_Option_get(Config_ASYNC_DELETE, &async_delete);
71
72 if(async_delete) {
73 // Async delete
74 // add deletion task to pool using force mode
75 // we can't lose this task in-case pool's queue is full
76 ThreadPools_AddWorkWriter(_GraphContext_Free, gc, 1);
77 } else {
78 // Sync delete
79 _GraphContext_Free(gc);
80 }
81 }
82}
83
84//------------------------------------------------------------------------------
85// GraphContext API

Callers 15

_CreateKeySpaceMetaKeysFunction · 0.85
_ClearKeySpaceMetaKeysFunction · 0.85
RG_ForkPrepareFunction · 0.85
RG_AfterForkParentFunction · 0.85
_ExecuteQueryFunction · 0.85
_queryFunction · 0.85
Graph_EffectFunction · 0.85
Graph_ExplainFunction · 0.85
CommandDispatchFunction · 0.85
Graph_ListFunction · 0.85
Graph_BulkInsertFunction · 0.85

Calls 3

Config_Option_getFunction · 0.85
_GraphContext_FreeFunction · 0.85

Tested by 2

tearDownFunction · 0.68
tearDownFunction · 0.68