exited(Term) as 
result state for thread_join/2. 
If the thread has the attribute
detached(true) it terminates, but its exit status cannot be 
retrieved using thread_join/2, 
making the value of Term irrelevant. The Prolog stacks and C 
thread are reclaimed.
The current implementation is based on the reserved
unwind( exception. This 
implies that, unlike the previous implementation that was based on the C
pthread_exit() function, the implementation is safe from the 
Prolog point of view. However, it is limited by the semantics of the
unwind exceptions. See section 
4.10.1 for details.
thread_exit(Term))
This predicate raises a permission_error if it is known 
that the thread cannot handle this case.