current_thread/3

current_thread(+ Id, - Status)*

Enumerates identifiers and status of all currently known threads. Calling current_thread//22 does not influence any thread. See also thread_join//22. For threads that have an alias-name, this name is returned in Id instead of the numerical thread identifier. Status is one of:

  • running The thread is running. This is the initial status of a thread. Please note that threads waiting for something are considered running too.

  • false The Goal of the thread has been completed and failed.

  • true The Goal of the thread has been completed and succeeded.

  • exited( Term) The Goal of the thread has been terminated using thread_exit//11 with Term as argument. If the underlying native thread has exited (using pthread_exit()) Term is unbound.

  • exception( Term) The Goal of the thread has been terminated due to an uncaught exception (see throw//11 and catch//33).