
线程
he_0123
这个作者很懒,什么都没留下…
展开
-
生产者消费者-线程-链表-队列实现
生产者消费者-线程-链表-队列实现链表实现#include<stdio.h> #include<pthread.h> #include<stdlib.h> #include<unistd.h>pthread_mutex_t lock; pthread_cond_t cond; struct node { int iValue; struct node *next; }*head =原创 2016-01-04 20:06:20 · 655 阅读 · 0 评论 -
火车售票-线程3种实现
火车售票 分别用互斥锁、条件变量、信号灯;用到线程 火车售票-互斥锁#include<stdio.h> #include<pthread.h>pthread_mutex_t mutex; int ticketCount = 20;void *saleWindow1(void *args) { while(1) { pthread_mutex_lock(&mutex原创 2016-01-04 20:47:12 · 965 阅读 · 0 评论