data race check with valgrind
2015-11-25 22:27
225 查看
http://valgrind.org/docs/manual/hg-manual.html
/* * gcc t.c -o t -g -lpthread * valgrind --tool=helgrind ./t */ #include <pthread.h> int var = 0; void* child_fn ( void* arg ) { var++; /* Unprotected relative to parent */ /* this is line 6 */ return NULL; } int main ( void ) { pthread_t child; pthread_create(&child, NULL, child_fn, NULL); var++; /* Unprotected relative to child */ /* this is line 13 */ pthread_join(child, NULL); return 0; }
相关文章推荐
- JS模版引擎实现原理
- android获取屏幕宽高
- JUnit4使用
- Java中获取完整的url
- Raspberrypi 2 树莓派2代 拨号华为E398设备
- MediaWiki 用起来还是比较麻烦的
- clock()与time()区别
- hdoj 1689 Just a Hook 【线段树区间更新求和】
- 对实体完整性和参照完整性的认识
- DMA的基本概念
- NSIndexSet基本用法
- windows下wavelib的配置和使用
- 蓝懿 iOS 技术交流和心得分享 11.25
- HDU 3652 B-number
- Ceph 单/多节点 安装小结 power by CentOS 6.x
- hdu 1754 I Hate It
- 实习半月之感触
- ReactNativeiOS(二)读书记录 2代码结构
- Java作业——学籍管理系统
- 实现常用字符串处理函数(不调用库函数)