thread_at_exit/1

thread_at_exit(: Term)*

Run Goal just before releasing the thread resources. This is to be compared to at_halt//11, but only for the current thread. These hooks are ran regardless of why the execution of the thread has been completed. As these hooks are run, the return-code is already available through @ref thread_propertyU2fU_2 "thread_property//2"2 using the result of @ref thread_selfU2fU_1 "thread_self//1"1 as thread-identifier. If you want to guarantee the execution of an exit hook no matter how the thread terminates (the thread can be aborted before reaching the @ref thread_at_exitU2fU_1 "thread_at_exit//1"1 call), consider using instead the @ref U60Uat_exitU2fU_1 "at_exit//1"1option of thread_create//33.