摘要: 谈到多线程编程,同步是一定要讲的。给个例子: #include <stdio.h> #include <stdlib.h> #include <pthread.h> int count = 0; #define N 100000 void* fun() { int i; for (i = 0; i 阅读全文
posted @ 2015-08-14 14:34 Sawyer Ford 阅读(341) 评论(0) 推荐(0) 编辑
摘要: linux下的多线程通过pthread实现,下面给个简单的例子。#include #include #include void* thr_fn(){ printf("this is a thread, tid = %d\n", pthread_self()); printf("thr... 阅读全文
posted @ 2015-08-14 10:30 Sawyer Ford 阅读(164) 评论(0) 推荐(0) 编辑