处理任务队列的工作线程的创建
工作线程的数量和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;