Availability:built-in
detached(true)
option for thread_create/3
and thread_detach/1).
A thread that has been completed without thread_join/2 being called on it is partly reclaimed: the Prolog stacks are released and the C thread is destroyed. A small data structure representing the exit status of the thread is retained until thread_join/2 is called on the thread. Defined values for Status are:
- true
- The goal has been proven successfully.
- false
- The goal has failed.
- exception(Term)
- The thread is terminated on an exception. See print_message/2 to turn system exceptions into readable messages.
- exited(Term)
- The thread is terminated on thread_exit/1 using the argument Term.
Note that the pthread primitive pthread_join() cannot be interrupted. Some systems provide pthread_timedjoin_np(). If this is provided thread_join/2 is implemented as a loop of timed joins with a 0.25 sec timeout while signals are being tested after each timeout. Such systems allow combining thread_join/2 with call_with_time_limit/2 as well as signalling threads blocked in thread_join/2 using thread_signal/2.