Ticket #3981 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 years ago

Change all read_* and write_* functions to return bool

Reported by: gemacke Owned by: gemacke
Priority: normal Milestone: 1.1
Version: 1.0 Severity: normal
Keywords: Cc:

Description

Returning a boolean indicating if a read or write function was successful instead of just dieing with an error is a better method. It allows the user to either die or handle the error better.

Change History

comment:1 Changed 8 years ago by gemacke

  • Status changed from new to accepted

comment:2 Changed 8 years ago by gemacke

Partially addressed for read_matrix_market() and write_matrix_market() in r3016.

comment:3 Changed 8 years ago by gemacke

The change that still needs to be made for read_matrix_market() (still needs to be made for read_dimacs() as well) is to switch from using exit() to using return false. This happens inside loops as well. I did this originally because it parallelized okay, but this really isn't good. One possibility is to keep an error buffer and an error count. When an iteration encounters an error, it could increment the error count. If the returned value of the increment is 0, that thread would copy its error message to the buffer. That way there would be no loop exits inside the loops. After the loops, print out the error message and return false if the error count is greater than 0.

This method needs to be tested to see how it parallelizes. It needs to pass canal and have the same or better performance in tests. If this doesn't work, then some other method needs to be used.

comment:4 Changed 8 years ago by gemacke

  • component Eldorado deleted

comment:5 Changed 8 years ago by gemacke

Mostly addressed in r3455. All of the functions now return bool. The only thing left is the exit() situation in read_matrix_market() and read_dimacs() described above.

comment:6 Changed 8 years ago by gemacke

  • Version set to 1.1
  • Milestone set to 1.0

comment:7 Changed 8 years ago by gemacke

  • Version changed from 1.1 to 1.0
  • Milestone changed from 1.0 to 1.1

comment:8 Changed 8 years ago by gemacke

  • Status changed from accepted to closed
  • Resolution set to fixed

I wrote a separate ticket for the remaining work (#4049) since the spirit of this ticket has been fulfilled.

Note: See TracTickets for help on using tickets.