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

Function _indexer_AddTask

src/index/indexer.c:238–261  ·  view source on GitHub ↗

add task to indexer queue

Source from the content-addressed store, hash-verified

236
237// add task to indexer queue
238static void _indexer_AddTask
239(
240 IndexerOp op,
241 void *pdata
242) {
243 // lock
244 int res = pthread_mutex_lock(&indexer->m);
245 ASSERT(res == 0);
246
247 // add task to queue
248 IndexerTask task = {.op = op, .pdata = pdata};
249
250 res = CircularBuffer_Add(indexer->q, &task);
251 ASSERT(res == 1);
252
253 // unlock
254 res = pthread_mutex_unlock(&indexer->m);
255 ASSERT(res == 0);
256
257 // signal conditional variable
258 pthread_mutex_lock(&indexer->cm);
259 pthread_cond_signal(&indexer->c);
260 pthread_mutex_unlock(&indexer->cm);
261}
262
263// pops a task from queue
264// if queue is empty caller will be waiting on conditional variable

Callers 4

Indexer_PopulateIndexFunction · 0.85
Indexer_DropIndexFunction · 0.85
Indexer_DropConstraintFunction · 0.85

Calls 1

CircularBuffer_AddFunction · 0.85

Tested by

no test coverage detected