I'm developing fine-grained multithreaded applications using C on Unix.
Most Pthreads functions return an integer, 0 to indicate success and
anything other than 0 to indicate error.
I know in general how to use assert, but I'm not sure how to handle
Pthreads functions returning error. So I'm thinking about using assert
to kill the application if something goes wrong. I would appreciate if
people could share their opinions:
1. The very nature of multithreaded code makes it very difficult to
gracefully recover if something goes wrong. For example if you can't
acquire or release a lock, what then?
2. A lot of functions call Pthreads lock, unlock, wait and signal
functions, is it practical to check every function's return value and
gracefully recover from errors?
3. If any of the Pthreads functions return error, it probably means
something went really wrong, so maybe the only option would be to kill
4. Unline Ada and C++, C does not have exceptions. What's the best way
to handle such errors in high availability applications, like databases
and online processing/transaction systems?
This message was posted to the following mailing lists: