OSJoinThread

Syntax

#include <revolution/os.h>

BOOL OSJoinThread(OSThread* thread, void** val);

Arguments

thread Pointer to thread to join.
val Pointer to a void pointer in which the thread's exit value is copied. If the thread was canceled with OSCancelThread, val will be assigned a value of (void*) -1. Specify NULL if the thread's exit value is not necessary.

Return Values

Returns TRUE if the specified thread does not have the detached attribute and has terminated normally. Otherwise, returns FALSE.

Description

As long as the specified thread is not "detached" (see OSDetachThread), the OSJoinThread function will wait for the specified thread to terminate and then generate information regarding the terminated thread.

Multiple threads cannot wait for the same thread to terminate. Only a single thread is guaranteed to return success; all other threads will return FALSE.

This function may put the current thread to sleep. For precautions when calling similar functions, refer to Interrupts and Callback Functions.

See Also

Thread Functions, Thread Synchronization Functions, OSCancelThread, OSDetachThread, OSExitThread, OSIsThreadTerminated, Interrupts and Callback Functions

Revision History

2007/09/25 Added information on the sleeping status of threads.
2006/03/01 Initial version.


CONFIDENTIAL