void select_timer_block(ticks interval) { struct timeval timeout; struct timeval *timeout_pointer = 0; int result; descriptor d; if (interval){ ticks_to_timeval(&timeout, interval); timeout_pointer = &timeout; } table_foreach (read_handlers, d, z) FD_SET((unsigned long)d, &reads); table_foreach (write_handlers, d, z) FD_SET((unsigned long)d, &writes); result = select(FD_SETSIZE, &reads, &writes, 0, timeout_pointer); if (result > 0) { scan_table(&reads, read_handlers); scan_table(&writes, write_handlers); } }
/* Executes the MATCH FILES command. */ static void execute_match_files (struct comb_proc *proc) { union value *by; while (case_matcher_match (proc->matcher, &by)) { struct ccase *output; size_t i; output = create_output_case (proc); for (i = proc->n_files; i-- > 0; ) { struct comb_file *file = &proc->files[i]; if (file->type == COMB_FILE) { if (file->is_minimal) { apply_case (file, output); advance_file (file, NULL); } } else { if (scan_table (file, by)) apply_case (file, output); } } output_case (proc, output, by); } output_buffered_case (proc); }
int runScanAll(NDBT_Context* ctx, NDBT_Step* step) { NdbInfo ndbinfo(&ctx->m_cluster_connection, "ndbinfo/"); if (!ndbinfo.init()) { g_err << "ndbinfo.init failed" << endl; return NDBT_FAILED; } Uint32 tableId = 0; while(true) { const NdbInfo::Table* table; int err = ndbinfo.openTable(tableId, &table); if (err == NdbInfo::ERR_NoSuchTable) { // No more tables -> return return NDBT_OK; } else if (err != 0) { // Unexpected return code g_err << "Failed to openTable(" << tableId << "), err: " << err << endl; return NDBT_FAILED; } ndbout << "table("<<tableId<<"): " << table->getName() << endl; int last_rows; for (int l = 0; l < ctx->getNumLoops(); l++) { if (ctx->isTestStopped()) return NDBT_OK; int rows = 0; if (!scan_table(ndbinfo, table, rows)) { ctx->stopTest(); return NDBT_FAILED; } // Check that the number of rows is same as last round on same table if (l > 0 && last_rows != rows) { g_err << "Got different number of rows this round, expected: " << last_rows << ", got: " << rows << endl; ndbinfo.closeTable(table); ctx->stopTest(); return NDBT_FAILED; } last_rows = rows; } ndbinfo.closeTable(table); tableId++; } // Should never come here require(false); return NDBT_FAILED; }
int main(void) { double sales[NUM_SALES_PEOPLE][NUM_QUARTERS]; /* table of sales */ double person_totals[NUM_SALES_PEOPLE]; /* row totals */ double quarter_totals[NUM_QUARTERS]; /* column totals */ int status; status = scan_table(sales, NUM_SALES_PEOPLE); if (status == 1) { sum_rows(person_totals, sales, NUM_SALES_PEOPLE); sum_columns(quarter_totals, sales, NUM_SALES_PEOPLE); display_table(sales, person_totals, quarter_totals, NUM_SALES_PEOPLE); } return (0); }