提交 86355b54 编写于 作者: A Andrew Hall 提交者: Heejae Chang

Add thread name to DiagnosticEventTaskScheduler (#30162)

* Add a thread name to the DiagnosticEventTaskScheduler

* Create an explicit thread for DiagnosticEventTaskScheduler
上级 c7bb120c
......@@ -13,16 +13,20 @@ namespace Microsoft.CodeAnalysis.Diagnostics
/// </summary>
internal class DiagnosticEventTaskScheduler : TaskScheduler
{
private readonly Task _mainTask;
private readonly Thread _thread;
private readonly BlockingCollection<Task> _tasks;
public DiagnosticEventTaskScheduler(int blockingUpperBound)
{
_tasks = new BlockingCollection<Task>(blockingUpperBound);
// portable layer doesnt support explicit thread creation. use long running task to create and hold onto a thread
_mainTask = Task.Factory.SafeStartNew(Start, CancellationToken.None,
TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, TaskScheduler.Default);
_thread = new Thread(Start)
{
Name = "Roslyn Diagnostics",
IsBackground = true
};
_thread.Start();
}
private void Start()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册