Ejemplo n.º 1
0
unsigned long long TomKva_v5(char* aname, char* cname, int seconds)
{
    FILE*       afile = fopen(aname, "r");
    FILE*       cfile = fopen(cname, "r");

    fm_count = 0;

    if (afile == NULL)
    {
        fprintf(stderr, "could not open file A\n");
        exit(1);
    }

    if (cfile == NULL)
    {
        fprintf(stderr, "could not open file c\n");
        exit(1);
    }

    _matrix* matA = parseMatrix(afile);
    _vector* vecC = parseVector(cfile);

    fclose(afile);
    fclose(cfile);

    Arena* arena = init_arena_basic(6, 6);

    if (seconds == 0)
    {
        /* Just run once for validation. */

        // Uncomment when your function and variables exist...
        int result = fm_elim(arena, matA->rows, matA->columns, matA->cells, vecC->elements);
        free_up(matA,vecC);
        destroy_arena(arena);
        return result;
        //return 1; // return one, i.e. has a solution for now...
    }

    /* Tell operating system to call function DONE when an ALARM comes. */
    signal(SIGALRM, done);
    alarm(seconds);

    /* Now loop until the alarm comes... */
    proceed = true;
    while (proceed)
    {
        // Uncomment when your function and variables exist...
        // fm_elim(rows, cols, a, c);
        fm_elim(arena, matA->rows, matA->columns, matA->cells, vecC->elements);
        fm_count++;
    }

    // Clean up
    free_up(matA,vecC);
    destroy_arena(arena);

    return fm_count;
}
//-----------------------------------------------------------------------------
void
rlc_um_free_all_resources (struct rlc_um_entity *rlcP)
{
//-----------------------------------------------------------------------------
  int             index;

  // TX SIDE
  free_cnt_up (&rlcP->pdus_to_mac_layer);

  if (rlcP->input_sdus_alloc) {
    for (index = 0; index < rlcP->size_input_sdus_buffer; index++) {
      if (rlcP->input_sdus[index]) {
        free_mem_block (rlcP->input_sdus[index]);
      }
    }
    free_mem_block (rlcP->input_sdus_alloc);
    rlcP->input_sdus_alloc = NULL;
  }
  // RX SIDE
  free_up (&rlcP->pdus_from_mac_layer);
  if ((rlcP->output_sdu_in_construction)) {
    free_mem_block (rlcP->output_sdu_in_construction);
  }
}