vscode编译的多线程_Visual Studio 2015调试在多线程应用程序中不起作用

bd96500e110b49cbb3cd949968f18be7.png

In my project I have a heavy part of code that should be executed on a separate thread without blocking UI. When debugger hits the breakpoint inside this code, VS2015 freezes for 5-10 seconds. After that, if I try to continue debug (by pressing Step Over, Step In or Continue), the app goes from paused state to working state, Debugging Tools are ticking, but nothing happens and there's 0% of CPU utilization. If I press Break All then, the "cursor" (don't know the correct term) is shown at Application.Run( new Form1() ); in Program.cs where Main() is.

As I'm pretty new to C#, I thought that there was some problem with my approach to multithreading, but apparently it happens whatever I try - using async/await with Tasks, using BackgroundWorker component, or simple new Th

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]中的代码是一个使用C#编写的多线程程序,通过使用Task.Run()方法和Thread.Sleep()方法来模拟多线程并行执行的情况。在主函数中创建了两个线程,并通过循环调用TestMethod()方法来模拟多个线程同时执行的情况。 引用\[2\]中的代码是一个使用C++编写的多线程程序,通过使用CreateThread()函数和WaitForSingleObject()函数来创建和管理线程。在主函数中创建了两个线程,并通过互斥对象hMutex来实现线程间的同步和互斥访问。 引用\[3\]中的代码是一个使用C++编写的OpenMP多线程程序,通过使用#pragma omp parallel指令来创建并行线程。在主函数中使用omp_get_thread_num()函数来获取当前线程的编号。 综上所述,Visual Studio是一个集成开发环境(IDE),可以用于开发多线程程序。它提供了丰富的工具和库来支持多线程编程,包括Task类、Thread类、OpenMP等。通过使用这些工具和库,开发者可以方便地创建和管理多线程,并实现并行执行的效果。 #### 引用[.reference_title] - *1* [Visual Studio线程中调试某一线程](https://blog.csdn.net/qq_24629901/article/details/124728144)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Visual Studio 2010多线程编程](https://blog.csdn.net/helei001/article/details/38303395)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Visual studio 配置OpenMP 多线编译环境](https://blog.csdn.net/daijingxin/article/details/116381505)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值