MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / dbq_poll_int

Function dbq_poll_int

lua/sp.c:669–694  ·  view source on GitHub ↗

Call with q->lock held. Unlocks q->lock on return. Returns -2:stopped -1:error 0:IX_NOTFND 1:IX_FND If IX_FND will push Lua table on stack.

Source from the content-addressed store, hash-verified

667// Returns -2:stopped -1:error 0:IX_NOTFND 1:IX_FND
668// If IX_FND will push Lua table on stack.
669static int dbq_poll_int(Lua L, dbconsumer_t *q)
670{
671 SP sp = getsp(L);
672 struct sqlclntstate *clnt = sp->clnt;
673 struct qfound f = {0};
674 int rc = dbq_get(&q->iq, 0, &q->last, &f.item, NULL, NULL, &q->fnd, &f.seq,
675 bdb_get_lid_from_cursortran(clnt->dbtran.cursor_tran));
676 Pthread_mutex_unlock(q->lock);
677 comdb2_sql_tick_no_recover_deadlock();
678 sp->num_instructions = 0;
679 if (rc == 0) {
680 char *err;
681 rc = push_trigger_args_int(L, q, &f, &err);
682 free(f.item);
683 if (rc != 1) {
684 SP sp = getsp(L);
685 luabb_error(L, sp, err);
686 free(err);
687 }
688 return rc;
689 }
690 if (rc == IX_NOTFND) {
691 return 0;
692 }
693 return -1;
694}
695
696static int dbq_poll(Lua L, dbconsumer_t *q, int delay_ms)
697{

Callers 1

dbq_pollFunction · 0.85

Calls 6

dbq_getFunction · 0.85
push_trigger_args_intFunction · 0.85
freeFunction · 0.85
luabb_errorFunction · 0.85

Tested by

no test coverage detected