public IoUringTransport(IOptions <IoUringOptions> options) { _options = (options ?? throw new ArgumentNullException(nameof(options))).Value; Limits.SetToMax(Resource.RLIMIT_NOFILE); List <int> cpus = null; if (_options.SetThreadAffinity) { cpus = CpuInfo.GetPreferredCpuIds(_options.ThreadCount); } var threads = new TransportThread[_options.ThreadCount]; int cpuIdx = 0; for (int i = 0; i < threads.Length; i++) { var cpuId = cpus == null ? TransportThread.NoCpuAffinity : cpus[cpuIdx++ % cpus.Count]; var thread = new TransportThread(_options, cpuId); thread.Run(); threads[i] = thread; } TransportThreads = threads; }
private TransportThread[] CreateTransportThreads() { var threads = new TransportThread[Options.ThreadCount]; for (int i = 0; i < threads.Length; i++) { var thread = new TransportThread(Options); thread.Run(); threads[i] = thread; } return(threads); }