当前位置: 首页>>代码示例>>C#>>正文


C# Thread.DisableComObjectEagerCleanup方法代码示例

本文整理汇总了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();
 }
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:18,代码来源:DepartmentListControl.cs

示例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");
 }
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:16,代码来源:SemesterControl.cs

示例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;
         }
     }
 }
开发者ID:fremag,项目名称:MemoScope.Net,代码行数:36,代码来源:ThreadsScript.cs

示例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();
            }
        }
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:26,代码来源:BrowserControl.cs


注:本文中的System.Threading.Thread.DisableComObjectEagerCleanup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。