linux线程

来源:互联网 发布:数控车床编程入门代码 编辑:程序博客网 时间:2024/05/22 08:43

1.多线程:

2.多线程优点:

3.创建线程:int re=pthread_create(&pid,NULL,(void*)mythread,NULL);

4.终止线程:pthread_exit(0);

5.互斥锁:

{

1.加锁:pthread_mutex_lock(&mutex);

2.解锁:pthread_mutex_unlock(&mutex);


}

6.退出线程:

7,.线程等待:pthread_join(pid,NULL);

8.线程标识:pthread_self();


0 0
原创粉丝点击