コード例 #1
0
        public Thread New(Action closure, ThreadPriority priority = ThreadPriority.Normal)
        {
            var thread = new Thread(new ThreadStart(closure));
            var number = Interlocked.Read(ref _number);
            Interlocked.Increment(ref _number);
            thread.Name = string.Concat(_prefix, number);
#if !COREFX
            thread.Priority = priority;
#endif
            _group.Add(thread);
            return thread;
        }
コード例 #2
0
        public static void SetPriority(System.Diagnostics.ThreadPriorityLevel priority)
        {
            var ths = System.Diagnostics.Process.GetCurrentProcess().Threads;

            bassThreadIDs = bassThreadIDs.FindAll((e) =>
            {
                foreach (System.Diagnostics.ProcessThread th in ths)
                {
                    if (e == th.Id)
                    {
#if DEBUG
                        Gageas.Lutea.Logger.Debug("スレッドID" + th.Id + " のプライオリティ" + priority);
#endif
                        th.PriorityLevel = priority;
                        return(true);
                    }
                }
                return(false);
            });
        }