本文整理汇总了C#中System.Threading.Thread.DisableComObjectEagerCleanup方法的典型用法代码示例。如果您正苦于以下问题:C# Thread.DisableComObjectEagerCleanup方法的具体用法?C# Thread.DisableComObjectEagerCleanup怎么用?C# Thread.DisableComObjectEagerCleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Thread
的用法示例。
在下文中一共展示了Thread.DisableComObjectEagerCleanup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DepartmentListControl
/// <summary>
/// This is deprecated, this needs to be converted to using the new HttpRrquest method as WinForms really shouldnt be used in a web session.
/// </summary>
public DepartmentListControl()
{
deptNodes = new List<HtmlNode>();
thrd = new Thread(new ThreadStart(
delegate
{
Init();
System.Windows.Forms.Application.Run(this);
}));
thrd.DisableComObjectEagerCleanup();
// set thread to STA state before starting
thrd.SetApartmentState(ApartmentState.STA);
thrd.Start();
thrd.Join();
}
示例2: SemesterControl
public SemesterControl(string log)
{
logFile = log;
thrd = new Thread(new ThreadStart(
delegate
{
Init();
System.Windows.Forms.Application.Run(this);
}));
thrd.DisableComObjectEagerCleanup();
// set thread to STA state before starting
thrd.SetApartmentState(ApartmentState.STA);
thrd.Start();
thrd.Join();
Log("Destroying Thread");
}
示例3: Run
public override void Run()
{
for(int i=0; i < N; i++)
{
Thread t = new Thread(() => DoSomething(i));
t.Name = $"Thread #{i}";
t.Start();
switch(i%8)
{
case 0:
t.Abort();
break;
case 1:
t.DisableComObjectEagerCleanup();
break;
case 2:
t.IsBackground = true;
break;
case 3:
t.Interrupt();
break;
case 4:
t.Priority = ThreadPriority.AboveNormal;
break;
case 5:
t.Priority = ThreadPriority.BelowNormal;
break;
case 6:
t.Priority = ThreadPriority.Highest;
break;
case 7:
t.Priority = ThreadPriority.Lowest;
break;
}
}
}
示例4: Init
private void Init()
{
try
{
thrd = new Thread(new ThreadStart(delegate
{
AttachHandlers();
ProcessNextSearch();
System.Windows.Forms.Application.Run(this);
}));
thrd.DisableComObjectEagerCleanup();
thrd.SetApartmentState(ApartmentState.STA);
thrd.Start();
thrd.Join();
}
catch (Exception ex)
{
Log(ex.Message);
if (ex.InnerException != null && ex.InnerException.Message != null)
Log(ex.InnerException.Message);
Application.Exit();
}
}