If main returns or any thread calls exitall threads

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pthread_exit(). If main() returns or any thread calls exit()all threads are terminated. Thread Examples hello.c Basic example hello_arg1.c Thread arguments hello_arg2.c Complex thread arguments Detached State Each thread can be either joinable or detached . Detached: on termination all thread resources are released by the OS. A detached thread cannot be joined. No way to get at the return value of the thread. ( a pointer to something: void * ). Joinable Thread Joinable: on thread termination the thread ID and exit status are saved by the OS. One thread can "join" another by calling pthread_join - which waits (blocks) until a specified thread exits. int pthread_join( pthread_t tid, void **status); Thread Safe library functions You have to be c...
View Full Document

This note was uploaded on 10/21/2011 for the course CSCI 4061 taught by Professor Tripathi during the Spring '08 term at Minnesota.

Ask a homework question - tutors are online