?? pthread_join.txt
字號:
--------------------------------------------------------------------------------AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1--------------------------------------------------------------------------------pthread_join, or pthread_detach SubroutinePurposeBlocks the calling thread until the specified thread terminates.LibraryThreads Library (libpthreads.a)Syntax#include <pthread.h>int pthread_join (pthread_t thread, void**value_ptr);int pthread_detach (pthread_t thread;**value_ptr);DescriptionThe pthread_join subroutine blocks the calling thread until the thread threadterminates. The target thread's termination status is returned in the statusparameter.If the target thread is already terminated, but not yet detached, the subroutinereturns immediately. It is impossible to join a detached thread, even if it isnot yet terminated. The target thread is automatically detached after all joinedthreads have been woken up.This subroutine does not itself cause a thread to be terminated. It acts like thepthread_cond_wait subroutine to wait for a special condition. Note: The pthread.h header file must be the first included file of each source file using the threads library. Otherwise, the -D_THREAD_SAFE compilation flag should be used, or the cc_r compiler used. In this case, the flag is automatically set.The pthread_detach subroutine is used to indicate to the implementation thatstorage for the thread whose thread ID is in the location thread can be reclaimedwhen that thread terminates. This storage shall be reclaimed on process exit,regardless of whether the thread has been detached or not, and may includestorage for thread return value. If thread has not yet terminated, pthread_detachshall not cause it to terminate. Multiple pthread_detach calls on the same targetthread causes an error.Parametersthread Specifies the target thread.status Points to where the termination status of the target thread will bestored. If the value is NULL, the termination status is not returned.Return ValuesIf successful, the pthread_join function returns zero. Otherwise, an error numberis returned to indicate the error.Error CodesThe pthread_join and pthread_detach functions will fail if:EINVAL The implementation has detected that the value specified by thread doesnot refer to a joinable thread.ESRCH No thread could be found corresponding to that specified by the giventhread ID.The pthread_join function will fail if:EDEADLK The value of thread specifies the calling thread.The pthread_join function will not return an error code of EINTR.Implementation SpecificsThis subroutine is part of the Base Operating System (BOS) Runtime.Related InformationThe pthread_exit subroutine, pthread_create subroutine, wait subroutine,pthread_cond_wait or pthread_cond_timedwait subroutines, the pthread.h file.Joining Threads in AIX Version 4.3 General Programming Concepts: Writing andDebugging Programs.Threads Library Quick Reference in AIX Version 4.3 General Programming Concepts:Writing and Debugging Programs.--------------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -