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