int main(int argc,char *argv[])
{
	init_queue(&buf);
	pthread_t producer,consumer1,consumer2;
	pthread_create(&producer,NULL,producer,NULL);
	pthread_create(&consumer1,NULL,consumer,NULL);
	pthread_create(&consumer2,NULL,consumer,NULL);

	pthread_join(&producer,NULL);
	pthread_join(&consumer1,NULL);
	pthread_join(&consumer2,NULL);

	destory_queue(&buf);
	



}
示例#2
0
int
main(int argc, char *argv[])
{
	queue q;
	qdata data = 0;
	q = init_queue(q, 4);
	enqueue(1, q);
	enqueue(2, q);

	destory_queue(&q);
	q = init_queue(q, 4);
	enqueue(3, q);

	data = dequeue(q);
	printf("dequeue : %d\n", data);
	data = dequeue(q);
	printf("dequeue : %d\n", data);
	data = dequeue(q);
	printf("dequeue : %d\n", data);
	return 0;
}