bool advance() { auto n_results = aku_cursor_read(cursor_, &sample_, sizeof(aku_Sample)); if (can_proceed()) { // Return true if cache is not empty assert(n_results == 0 || n_results == sizeof(aku_Sample)); return n_results; } return false; }
static int wait_for_queue(struct task_struct** task_storage, bool(*can_proceed)(struct kfifo*), struct kfifo * queue) { *task_storage = current; set_current_state(TASK_INTERRUPTIBLE); while (!can_proceed(queue)) { schedule(); set_current_state(TASK_INTERRUPTIBLE); } __set_current_state(TASK_RUNNING); *task_storage = NULL; return 0; }
LocalCursor(aku_Database *db, aku_Cursor *cursor) : db_(db) , cursor_(cursor) { can_proceed(); }