文章分类 -  自调

摘要:i am main threadi am thread 2i am thread 1join1 rval is 0 //成功join2 rval is 22 //失败,已经分离了,连接的话就会错误thread1 err code is 1 thread2 err code id -121690931 阅读全文
posted @ 2019-07-03 22:01 道微真理 阅读(75) 评论(0) 推荐(0)
摘要:三种: 1、从启动线程中退出,返回值是线程的退出码 2、线程可以被同一进程中的其他线程取消 3、pthread_exit(void *val)函数 切记,不要使用exit\Exit\_exit函数,他们会结束整个进程 阅读全文
posted @ 2019-07-03 18:17 道微真理 阅读(258) 评论(0) 推荐(0)
摘要:#include"stdio.h" #include"string.h" #include"stdlib.h" #include"pthread.h" struct student{ //给新的线程传递一个结构体:main线程可以传递参数 int age; char name[20]; }; void *thread_fun(void *stu) { sleep(1)... 阅读全文
posted @ 2019-07-03 17:36 道微真理 阅读(83) 评论(0) 推荐(0)
摘要:输入命令: ibus-daemon -drx 即可。 阅读全文
posted @ 2019-07-03 17:12 道微真理 阅读(202) 评论(0) 推荐(0)