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

正文內(nèi)容

多線程并行編程模型(已改無錯(cuò)字)

2023-06-26 23:22:49 本頁面
  

【正文】 ) { BOOL bFound = bigFind()。 if (bFound) { SetEvent(hObj[0])。 // 滿足激發(fā)條件 bigFound()。 } moreBigStuff()。 return 0。 } 指導(dǎo)案例:事件 2021年 6月 17日 . . . hObj[0] = CreateEvent(NULL, FALSE, FALSE, NULL)。 hObj[1] = CreateThread(NULL,0,threadFunc,NULL,0,NULL)。 DWORD waitRet = WaitForMultipleObjects(2, hObj, FALSE, INFINITE)。 switch(waitRet) { case WAIT_OBJECT_0: printf (found it!\n)。 WaitForSingleObject(hObj[1], INFINITE) 。 case WAIT_OBJECT_0+1 printf (thread done\n)。 break 。 default: printf (“wait error: ret %u \n, waitRet)。 break 。 } 指導(dǎo)案例:事件 2021年 6月 17日 . . . hObj[0] = CreateEvent(NULL, FALSE, FALSE, NULL)。 hObj[1] = CreateThread(NULL,0,threadFunc,NULL,0,NULL)。 /* Do some other work while thread executes search */ DWORD waitRet = WaitForMultipleObjects(2, hObj, FALSE, INFINITE)。 switch(waitRet) { case WAIT_OBJECT_0: printf (found it!\n)。 WaitForSingleObject(hObj[1], INFINITE) 。 case WAIT_OBJECT_0+1。 printf (thread done\n)。 break 。 default: printf (“wait error: ret %u \n, waitRet)。 break 。 } 指導(dǎo)案例:事件 2021年 6月 17日 特點(diǎn): 允許一個(gè)或者更多的線程進(jìn)入臨界區(qū) 用于與多個(gè)可用資源的訪問 對(duì)信號(hào)量的操作可以概括為以下兩種操作 : Wait [P(s)]: s = s1 Post [V(s)]: s = s+1 信號(hào)量 2021年 6月 17日 ?原型 : ? ?0 = count = ISemMax. ?SemMax 0. HANDLE CreateSemaphore( LPSECURITY_ATTRIBUTES lpEventAttributes, LONG lSemInitial, //初始化的值 LONG lSemMax, //最大值 LPCSTR lpSemName)。 信號(hào)量的創(chuàng)建 2021年 6月 17日 ?WaitForSingleObject() // wait操作 如果 semaphore count = 0, 如果 semaphore count 0, 執(zhí)行信號(hào)量減 1操作后返回 . ?post操作 BOOL ReleaseSemaphore( HANDLE hSemaphore, LONG cReleaseCount, LPLONG lpPreviousCount)。 Wait和 Post操作 2021年 6月 17日 ?常用于: 控制對(duì)有限數(shù)據(jù)空間的訪問 限制對(duì)一段給定代碼的線程訪問數(shù)量 控制對(duì)有限資源的訪問 當(dāng)信號(hào)量定義為 1時(shí),類似于互斥量 信號(hào)量的使用 2021年 6月 17日 HANDLE hSem1, hSem2。 FILE *fd。 int fiveLetterCount = 0。 main() { HANDLE hThread[NUMTHREADS]。 hSem1 = CreateSemaphore(NULL, 1, 1, NULL)。 // Binary semaphore hSem2 = CreateSemaphore(NULL, 1, 1, NULL)。 // Binary semaphore fd = fopen(“InFile”
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1