pthread II - PthreadII Outline Join MutexVariables...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
    Pthread II
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
    Outline Join Mutex Variables  Condition Variables 
Background image of page 2
    Join Mutex Variables  Condition Variables 
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
    "Joining" is one way to accomplish synchronization between threads.
Background image of page 4
    1. Declare a pthread attribute variable of the  pthread_attr_t data type  1. Initialize the attribute variable with  pthread_attr_init()  1. Set the attribute detached status with  pthread_attr_setdetachstate()  1. When done, free library resources used by the  attribute with pthread_attr_destroy() 
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
    int pthread_join( pthread_t tid, void **status ); If successful, the pthread_join() function shall  return zero;  otherwise, an error number shall be returned to  indicate the error (the number>0)
Background image of page 6
    Join Mutex Variables  Condition Variables 
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
    Typical Sequence Create and initialize a mutex variable  Several threads attempt to lock the mutex 
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/29/2009 for the course INFO ENGI 9801 taught by Professor Wu during the Spring '09 term at 東京国際大学.

Page1 / 18

pthread II - PthreadII Outline Join MutexVariables...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online