nuno-silva/proj-so

Signal SIGUSR2 for WRITER (Exercise 5.2)

Closed this issue · 3 comments

WRITER must process the signal SIGUSR2.

Implemented, however not yet tested. Not closing for now.

You should have referenced this issue in commit d2e6c72.

The behavior introduced in bdd929e is not what you expected it to be. Each call to writer(file_num, rand_str, WRITER_STRING_LEN, use_locks) writes the whole 1024 lines (writes rand_str 1024 times) to file_num so, instead of writing errors in odd lines, you are writing errors in odd files.
You should move the error writing feature into the writer function. That way, you can have control over each and every line that is written to the file. I recommend passing enable_writing_errors to the writer function as a parameter.