It doesn’t catch any exception, the following also prints the warning also.
?- thread_create(catch(sleep(0.5),_,true),T,[detached(true)]),
thread_signal(T,throw(done)). % notice the exception is not abort
T = <thread>(4,0x562b28a93680).
Warning: [Thread 4] Thread running "'$thread_init'" died on exception: Unknown message: done
Yes, I can do that too.
The use case is rather uncommon I guess, it is just a dummy thread used in one test, and in another test I wanted to make sure the thread was dead because the alias is reused in the second test and I just wanted to get rid of the message.
I will just not use detached on the first test and join the thread.
Nonetheless, thread_create/3 docs mention that one can use catch/3 to catch the exception in a detached thread (this is why I kept the detached thread):
If a detached thread dies due to failure or exception of the initial goal, the thread prints a message using print_message/2. If such termination is considered normal, the code must be wrapped using ignore/1 and/or catch/3 to ensure successful completion.