久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么 Windows 10 會在我的程序中啟動額外的線程

Why does Windows 10 start extra threads in my program?(為什么 Windows 10 會在我的程序中啟動額外的線程?)
本文介紹了為什么 Windows 10 會在我的程序中啟動額外的線程?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

使用 Visual Studio 2015,在一個新的空 C++ 項目中,為控制臺應用程序構建以下內容:

With Visual Studio 2015, in a new, empty C++ project, build the following for Console application:

int main() {
    return 0;
}

在返回時設置斷點并在調試器中啟動程序.在 Windows 7 上,截至斷點,該程序只有一個線程.但是在 Windows 10 上,它有五個(!)線程:主線程和四個等待同步對象的工作線程".

Set a break point on the return and launch the program in the debugger. On Windows 7, as of the break point, this program has only one thread. But on Windows 10, it has five(!) threads: the main thread and four "worker threads" waiting on a synchronization object.

誰在啟動線程池(或者我如何知道)?

Who's starting up the thread pool (or how do I find out)?

推薦答案

Crystal ball 說 Debug > Windows > Threads 窗口在 ntdll.dll!TppWorkerThread 顯示這些線程.一定要讓 Microsoft 符號服務器自己查看,使用工具 > 選項 > 調試 > 符號.

Crystal ball says that the Debug > Windows > Threads window shows these threads at ntdll.dll!TppWorkerThread. Be sure to enable the Microsoft Symbol Server to see this yourself, use Tools > Options > Debugging > Symbols.

這也發生在 VS2013 中,所以它絕對不是由新的 VS2015 診斷功能引起的,@Adam 的猜測是不正確的.

This also happens in VS2013 so it is most definitely not caused by the new VS2015 diagnostic features, @Adam's guess cannot be correct.

TppWorkerThread() 是線程池線程的入口點.當我在此函數上使用 Debug > New Breakpoint > Function Breakpoint 設置斷點時.當第二個線程池線程開始執行時,我很幸運地為第一個線程池線程捕獲了這個堆棧跟蹤:

TppWorkerThread() is the entrypoint for a thread-pool thread. When I set a breakpoint with Debug > New Breakpoint > Function Breakpoint on this function. I got lucky to capture this stack trace for the 1st threadpool thread when the 2nd threadpool thread started executing:

    ntdll.dll!_NtOpenFile@24()  Unknown
    ntdll.dll!LdrpMapDllNtFileName()    Unknown
    ntdll.dll!LdrpMapDllSearchPath()    Unknown
    ntdll.dll!LdrpProcessWork() Unknown
    ntdll.dll!_LdrpWorkCallback@12()    Unknown
    ntdll.dll!TppWorkpExecuteCallback() Unknown
    ntdll.dll!TppWorkerThread() Unknown
    kernel32.dll!@BaseThreadInitThunk@12()  Unknown
    ntdll.dll!__RtlUserThreadStart()    Unknown
>   ntdll.dll!__RtlUserThreadStart@8()  Unknown

顯然加載器正在使用 Windows 10 上的線程池來加載 DLL.這當然是新的:) 此時主線程也在加載器中執行,并發在工作.

Clearly the loader is using the threadpool on Windows 10 to load DLLs. That's certainly new :) At this point the main thread is also executing in the loader, concurrency at work.

因此,Windows 10 正在利用多個內核來更快地初始化進程.非常重要的功能,而不是錯誤:)

So Windows 10 is taking advantage of multiple cores to get the process initialized faster. Very much a feature, not a bug :)

這篇關于為什么 Windows 10 會在我的程序中啟動額外的線程?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

What is the fastest way to transpose a matrix in C++?(在 C++ 中轉置矩陣的最快方法是什么?)
Sorting zipped (locked) containers in C++ using boost or the STL(使用 boost 或 STL 在 C++ 中對壓縮(鎖定)容器進行排序)
Rotating a point about another point (2D)(圍繞另一個點旋轉一個點 (2D))
Image Processing: Algorithm Improvement for #39;Coca-Cola Can#39; Recognition(圖像處理:Coca-Cola Can 識別的算法改進)
How do I construct an ISO 8601 datetime in C++?(如何在 C++ 中構建 ISO 8601 日期時間?)
Sort list using STL sort function(使用 STL 排序功能對列表進行排序)
主站蜘蛛池模板: 加勒比综合 | 亚洲黄色小视频 | 久久久久久久成人 | 九九在线 | 黄色一级片黄色一级片 | 美国一级大黄一片免费中文 | 日本特级黄色片 | 免费av大片 | 色99999| 色综合色综合 | 日韩在线观看 | 亚洲成人国产 | 久久在线 | 欧美日韩一区二区三区视频 | 成人毛片在线观看 | 久久久一本 | 国产成人午夜精品 | 国产香蕉av | 国产激情一区二区三区 | 亚洲免费av在线 | 久久久久久久久久国产 | 欧美午夜片 | 日日夜夜综合网 | 久久久久九九九九 | 日日av | 日本韩国三级 | 久草久草久草 | 狠狠操狠狠操 | 亚洲免费一区二区 | 亚洲精品a| 国产精品婷婷 | 四虎欧美 | 欧美日韩精品在线观看 | 国产网站视频 | av天天操| 成人免费毛片嘿嘿连载视频 | brazzers疯狂作爱 | 可以看毛片的网站 | 免费看色片 | 亚洲一区二区三区在线视频 | 午夜久久久 |