否
否 是 否
是
是
否
否
是
4.源程序
4.1 .ReaderAndWriter.CPP // 具体的实现
#include "windows.h"
#include <conio.h>
#include <stdlib.h>
#include <fstream.h>
#include <io.h>
#include <string.h>
#include <stdio.h>
#define READER 'R' //读者
#define WRITER 'W' //写者
#define INTE_PER_SEC 1000 //每秒时钟中断的数目
#define MAX_THREAD_NUM 64 //最大线程数
#define MAX_FILE_NUM 32 //最大文件数目数
#define MAX_STR_LEN 32 //字符串的长度
int readcount=0; //读者数目
int writecount=0; //写者数目
CRITICAL_SECTION RP_Write; //临界资源
CRITICAL_SECTION cs_Write;
CRITICAL_SECTION cs_Read;
struct ThreadInfo
{
int serial; //线程序号
char entity; &
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/8/8
基于C++的读者与写者问题read—write problem的实现(三)由毕业论文网(www.huoyuandh.com)会员上传。