摘要: reference:http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html#Atomic-BuiltinsA built-in function is a coding extension to C and C++ that 阅读全文
posted @ 2017-10-18 09:54 zxiaocheng 阅读(453) 评论(0) 推荐(0) 编辑
摘要: 多线程经常会在Linux的开发中用到,我想把平时的使用和思考记录下来,一是给自己做个备忘,二是分享给可能会用到的人。 POSIX标准下互斥锁是pthread_mutex_t,与之相关的函数有: 初始化锁用pthread_mutex_init,也可以用pthread_mutex_t mutex = P 阅读全文
posted @ 2017-10-18 09:53 zxiaocheng 阅读(2645) 评论(0) 推荐(0) 编辑
摘要: 函数原型 函数原型 #include <time.h> int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); 描述 描述 nanosleep()函数会导致当前的线程将暂停执行,直到rqtp参数所指定的时间间隔。或者在指定 阅读全文
posted @ 2017-10-18 09:51 zxiaocheng 阅读(3855) 评论(0) 推荐(0) 编辑