CBL_THREAD_DETACH

Frees thread resources when the thread terminates.

Syntax:
call "CBL_THREAD_DETACH" using by value thread-id
Parameters:
Using call prototype (see Library Routines - Key) Picture (32-bit systems)
thread-id cblt-pointer usage pointer.
On Entry:
thread-id A pointer to the thread identifier.
On Exit:
return-code A value indicating success or otherwise. See RETURN-CODE Values For Thread-control Routines.
Comments:

CBL_THREAD_DETACH enables a thread's resource to be freed when that thread terminates. When a thread is created (non-detached) a handle is returned to the creator. That handle can be used to wait for a thread, retrieve a return-code from the thread, inspect a thread's state, and so on. If a thread terminates, that handle is still valid until a WAIT or DETACH is done; that is, resources are still allocated to the (terminated) thread. If a thread is detached then all resources from a terminated thread are freed immediately; if the thread is still active those resources are marked to be freed when the thread terminates.

Behavior is undefined if:

If successful, RETURN-CODE is set to 0. If unsuccessful, the call will attempt to return an error number. However, because some behaviors are undefined, a call that fails could result in a run-time system error.

See Also: