标签:org creat printf 语言 amp tle read 计算机科学 封装
typedefstruct{
volatileint32_t cnt;/**< An internal counter value. */
}rte_atomic32_t;
rte_atomic32_t pkt_count;
pkt_count.cnt +=......
#include<pthread.h>
#include<stdio.h>
volatileint test=0;
//pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
void* print_xs (void* used)
{
//pthread_rwlock_wrlock(&rwlock);
test=test+2;
//pthread_rwlock_unlock(&rwlock);
sleep(1);
//pthread_rwlock_wrlock(&rwlock);
test=test+3;
//pthread_rwlock_unlock(&rwlock);
}
int main (){
pthread_t thread_id[100];
int data=0;
int i=0;
for(i=0; i<100; i++){
pthread_create (&(thread_id[i]), NULL, print_xs, NULL);
}
for(i=0; i<100; i++){
pthread_join(thread_id[i],NULL);
}
printf("%d\n",test);
return-1;
}
标签:org creat printf 语言 amp tle read 计算机科学 封装
原文地址:http://www.cnblogs.com/yml435/p/6485895.html