How to detect when main thread terminates?

前端 未结 5 1244
难免孤独
难免孤独 2020-12-21 10:26

What I need to know:

I would like to detect when a the main thread (process?) terminates so that I can ensure certain actions are performed before i

5条回答
  •  长情又很酷
    2020-12-21 11:11

    You should have an entry point for your application. Normally you can do there some logging when all tasks are terminated:

    static void Main()
    {
      try
      {
        Application.Run( .... );
      }
      finally
      {
        // logging ...
      }
    }
    

提交回复
热议问题