处理任务队列的工作线程的创建
处理任务队列的工作线程的创建
工作线程的数量和CPU数量是息息相关的,CPU数量越多则可以创建越多的工作线程数量。
var
si: TSystemInfo;
GetSystemInfo(si);
g_decode_handle := CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 1);
g_work_handle := CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, si.dwNumberOfProcessors);
SetLength(workers, si.dwNumberOfProcessors);
Label6.Caption := IntToStr(si.dwNumberOfProcessors);
for i := Low(workers) to High(workers) do
workers[i] := TWorkThread.Create;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/5864537.html