關於等待多於64個執行緒的解決方法

2021-05-26 07:34:35 字數 546 閱讀 1002

c++中,waitformultipleobjects函式的功能是:等待n個物件(這裡是執行緒)全部結束後,再執行後面的語句。該函式第乙個引數是要等待的物件數,該引數的資料型別儘管是dword,但實際上這個引數是有限制的,它的值應該是大於0而小於maximum_wait_objects。

參見winnt.h

#define maximum_wait_objects 64     // maximum number of wait objects

因而當執行緒數多於64時waitformultipleobjects應做如下更改:

int tempnumthreads = numthreads;

int tempmax = 0;

while( tempnumthreads >= maximum_wait_objects )

waitformultipleobjects( tempnumthreads, &hthread[ tempmax ], true, infinite);

上面是我在網上找到的**,然後根據此我對我的**修改,ok ,搞定!!哈哈

Ubuntu關機等待90秒的問題與解決方案

ubuntu關機等待90秒的問題與解決方案 本文討論的 等待90秒 是指ubuntu系統關機時,系統退出,進入黑屏狀態後,左上角的白色游標需要閃約90秒,系統才能真的關閉。這個等待時間是系統預先設定的 等待程序關閉的最長時間。當系統出現需要等待90秒才能關閉這個現象時,往往說明系統有程序不能正常關閉...

關於android adb 程序占用的解決方法

1 今天除錯android的時候發現乙個詭異的問題 c users x adb start server adb server is out of date.killing.adb server didn t ack failed to start daemon 2.adb 不管執行 shell d...

SharePoint 關於拓撲錯誤的解決方案

topology 報錯資訊 sharepoint web services round robin service load balancer event endpointfailure affected endpoint 主要是兩種型別的 sharepoint service metadatawe...