|Did you know ...||Search Documentation:|
at_exit(Goal)option of thread_create/3 is designed to deal with this scenario.
The Goal is executed with signal processing disabled. This
avoids that e.g.,
thread_signal(Thread, abort) kills the
exit handler rather than the thread in the case the body of Thread
has just finished when the signal arrives.