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; }
public IoUringTransport(IOptions <IoUringOptions> options, ILoggerFactory loggerFactory) { Options = (options ?? throw new ArgumentNullException(nameof(options))).Value; LoggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); Limits.SetToMax(Resource.RLIMIT_NOFILE); }