public Thread NewThread(IRunnable r) { var t = new Thread(r.Run, 0) { Name = _namePrefix + _threadNumber.ReturnValueAndIncrement() }; // Lower the priority of the peer threads. This is to avoid competing with UI threads created by the API // user when doing lots of work, like downloading the block chain. We select a priority level one lower // than the parent thread, or the minimum. t.Priority = (ThreadPriority)Math.Max((int)ThreadPriority.Lowest, ((int)Thread.CurrentThread.Priority) - 1); t.IsBackground = true; return(t); }
public virtual Thread NewThread(IRunnable r) { var t = new Thread(r.Run); t.Name = namePrefix + threadNumber.ReturnValueAndIncrement(); if (t.IsBackground) { t.IsBackground = false; } if (t.Priority != ThreadPriority.Normal) { t.Priority = ThreadPriority.Normal; } return(t); }
public virtual Thread NewThread(IRunnable r) { var t = new Thread(r.Run) { Name = NamePrefix + ThreadNumber.ReturnValueAndIncrement() }; if (t.IsBackground) { t.IsBackground = false; } // ReSharper disable RedundantCheckBeforeAssignment if (t.Priority != ThreadPriority.Normal) { // ReSharper restore RedundantCheckBeforeAssignment t.Priority = ThreadPriority.Normal; } return(t); }
internal DefaultThreadFactory() { namePrefix = "pool-" + poolNumber.ReturnValueAndIncrement() + "-thread-"; }
public PeerGroupThreadFactory() { _namePrefix = "PeerGroup-" + _poolNumber.ReturnValueAndIncrement() + "-thread-"; }