What are the other threads in a default VCL application, and can they be named by purpose?

前端 未结 1 1581
情歌与酒
情歌与酒 2020-12-30 06:27

If you create a basic VCL application and execute it, there are a few threads running. What are each of the threads for and can they be named to make it easier to debug mult

1条回答
  •  有刺的猬
    2020-12-30 06:58

    A plain vanilla 32 bit VCL app in XE2, running on 64 bit Windows 7 has 3 threads. The main thread and two extras. The two extra threads are created in TApplication.CreateHandle by a call to WTSRegisterSessionNotification. If you want to name them then you can enumerate the threads in the process and call NameThreadForDebugging.

    In my experience, it's very hard to keep track of all the threads in your app. As soon as your app becomes moderately complex then there are liable to be plenty of threads coming and going. I personally view the ones that I have not named as being somebody else's responsibility!

    0 讨论(0)
提交回复
热议问题