Skip to content

mcproxy: fix exceptions handling in threads

Anatoly Mirin requested to merge mirin/mcproxy-fix_thread_exceptions into devel

An exception in a non-main thread cannot be caught by the try ... catch block in the main() and causes the program to terminate (treated as a crash).

To fix this behavior, a try... catch block has been added to the wrapper of all worker threads, in the worker_thread_internal() function. Now, when a thread catches an exception, a pointer to that exception is passed to the main thread along with the finish command - proxy::finish(). The main thread rethrows this exception and handles it as usual in the main() block.

see https://project.iopsys.eu/issues/10106

Merge request reports