摘要:
/* productandconsumer. cpp */#include <windows.h>#include <stdio.h>#include <stdlib.h>typedef HANDLE Semaphore; //信号量的Windows 原型#define P(S) WaitForSingleObject (S, INFINITE) //定义P操作#define V(S) ReleaseSemaphore (S, 1, NULL) //定义V操作#define CONSUMER_NUM 10 /* 消费者个数*/#define PRODUCER 阅读全文