[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


cma_thread_join

Causes the calling thread to wait for the termination of a specified thread.

Syntax

cma_thread_join(
                thread,
                exit_status,
                result);
 


Argument Data Type Access

thread opaque cma_t_thread read exit_status opaque cma_t_exit_ write status result pointer write


C Binding

#include 

void cma_thread_join ( cma_t_thread *thread, cma_t_exit_status *exit_status, cma_t_address *result);

Arguments

thread
Handle of the thread whose termination is awaited by the caller of this routine.
exit_status
Variable that receives a value indicating whether the thread specified by thread successfully terminated. Valid values are as follows:
Value                 Description

cma_c_term_normal Normal termination cma_c_term_error Error termination (result of calling cma_thread_exit_error() ) cma_c_term_alert Alert termination


result
Address value that is optionally returned by the start_ routine of the thread specified by the thread argument in its call to cma_thread_create.

Description

This routine causes the calling thread to wait for the termination of a specified thread. A call to this routine returns after the specified thread has terminated.

The value returned as the exit_status argument indicates whether the thread terminated normally, because of an error, or because of an alert.

The value returned as the result argument is the address that the specified thread generates as its result. The thread's result is normally returned as the value of the start_ routine argument in its call to cma_thread_create. In order for the result argument to be valid, the following must occur:

Any number of threads can call this routine. All threads are awakened when the specified thread terminates. If the thread is already terminated, this routine returns immediately.

If the current thread calls this routine, a deadlock results if it is detected by the implementation.

The results of this routine are unpredictable if the value for thread refers to cma_c_null or a thread that has been detached.

This routine is alertable.

Exceptions

cma_e_alerted
cma_e_existence
cma_e_use_error



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]