Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ thr_join(3T) — SunOS 5.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

thr_create(3T)

thr_join(3T)

NAME

thr_join − wait for thread termination

SYNOPSIS

#include <thread.h>

int thr_join(thread_t wait_for, thread_t ∗departed, void ∗∗status);

MT-LEVEL

MT-Safe

DESCRIPTION

thr_join() blocks the calling thread until the thread specified by wait_for terminates.  The specified thread must be in the current process and must not be detached (see thr_create(3T)).  If wait_for is (thread_t)0, then thr_join() waits for any undetached thread in the process to terminate. 

If departed is not NULL, it points to a location that is set to the ID of the terminated thread if thr_join() returns successfully.  If status is not NULL, it points to a location that is set to the exit status of the terminated thread if thr_join() returns successfully. 

Multiple threads cannot wait for the same thread to terminate; one thread will return successfully and the others will fail with an error of ESRCH. 

RETURN VALUES

Zero is returned when successful.  A non-zero value indicates an error. 

ERRORS

If any of the following conditions are detected, thr_join() fails and returns the corresponding value:

ESRCH wait_for is not a valid, undetached thread in the current process. 

EDEADLK wait_for specifies the calling thread. 

SEE ALSO

thr_create(3T)

SunOS 5.4  —  Last change: 22 Jan 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026