
多线程
黑帽子和猫
不要总当机会到来时,你才唏嘘“哎呀,那时我怎么怎么样就好。。。”,你已经错过很多次,记住这是最后一次
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
pthread_create传递线程参数需要注意的问题
程序如下void* thread_rountine(void *arg) { int *cnt = (int*)arg; for (int i=0; i<5; ++i) printf("%d-hello\n",*cnt); return 0; }int main(void) { pthread_t pid[2]; int ret; fo原创 2017-03-05 16:09:12 · 5437 阅读 · 2 评论 -
两种调试死锁的方法
方法1:通过core文件调试死锁步骤: 1. ulimited -c unlimted(打开core,默认没有打开) 2. 运行./a.out(编译的时候加调试选项-g) 死锁阻塞,Ctrl+\ 产生core dump 3. gdb ./a.out core.xxx 4. thread apply all bt查看死锁位置 例子(待续…)#include <stdio.h>原创 2017-04-16 23:22:50 · 2141 阅读 · 0 评论