freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

讀者寫者問題操作系統(tǒng)課程設計(已改無錯字)

2023-04-25 12:06:47 本頁面
  

【正文】 {g_hReadSemaphore = CreateSemaphore(NULL,1,100,NULL)。 //創(chuàng)建信號燈,當前可用的資源數(shù)為1,最大為100g_hWriteSemaphore = CreateSemaphore(NULL,1,100,NULL)。 //創(chuàng)建信號燈,當前可用的資源數(shù)為1,最大為100CreatePersonList(g_PersonLists)。 // Create All the reader and writersprintf(Created all the reader and writer\n...\n)。g_CurrentTime = 0。while(true){g_CurrentTime++。Sleep(300)。 // 300 msprintf(CurrentTime = %d\n,g_CurrentTime)。if(finished) return 0。} // return 0。}void CreatePersonList(int *pPersonLists){int i=0。int *pList = pPersonLists。bool Ret。while(pList[0] != END){switch(pList[1]){case R:Ret = CreateReader(pList[2],pList[3],pList[0])。//351,w452,523,654break。 case W:Ret = CreateWriter(pList[2],pList[3],pList[0])。break。}if(!Ret)printf(Create Person %d is wrong\n,pList[0])。pList += 4。 // move to next person list}}DWORD WINAPI ReaderProc(LPVOID lpParam)//讀過程{Person *pPerson = (Person*)lpParam。// wait for the start timewhile(g_CurrentTime != pPersonm_nStartTime){ }printf(Reader %d is Requesting ...\n,pPersonm_nID)。printf(\n\n************************************************\n)。// wait for the write requestWaitForSingleObject(g_hReadSemaphore,INFINITE)。 if(g_NumOfReading ==0){WaitForSingleObject(g_hWriteSemaphore,INFINITE)。 }g_NumOfReading++。ReleaseSemaphore(g_hReadSemaphore,1,NULL)。pPersonm_nStartTime = g_CurrentTime。printf(Reader %d is Reading the Shared Buffer...\n,pPersonm_nID)。printf(\n\n************************************************\n)。while(g_CurrentTime = pPersonm_nStartTime + pPersonm_nWorkTime){}printf(Reader %d is Exit...\n,pPersonm_nID)。printf(\n\n************************************************\n)。WaitForSingleObject(g_hReadSemaphore,INFINITE)。g_NumOfReading。if(g_NumOfReading == 0){ReleaseSemaphore(g_hWriteSemaphore,1,NULL)。//此時沒有讀者,可以寫}ReleaseSemaphore(g_
點擊復制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1