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.
| 667 | // Returns -2:stopped -1:error 0:IX_NOTFND 1:IX_FND |
| 668 | // If IX_FND will push Lua table on stack. |
| 669 | static 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 | |
| 696 | static int dbq_poll(Lua L, dbconsumer_t *q, int delay_ms) |
| 697 | { |
no test coverage detected