现在的位置: 首页 > 综合 > 正文

pthread

2013年05月30日 ⁄ 综合 ⁄ 共 520字 ⁄ 字号 评论关闭

note:

Process Mode:

pid_t pid = fork()

if ( pid == 0)

{  // child process to do }

else

{ // parent process to do

  // waitpid( pid, & status, WNOHANG)

}

Pthread API

pthread_t thread;

int pthread_create( pthread_t * thread, const pthread_att_t * att,

                                void *(*start)(void *), void * arg)

pthread_t  pthread_self()

int sched_yield()

int pthread_exit( void * value_ptr);

int pthread_detach( pthread_t pthread)

int pthread_jion( pthread_t thread, void **value_ptr)

2. synchronous

 mutax

 condition variable ( when the mutux condition does not meet, it will releas the mutux)

 semphore

抱歉!评论已关闭.