Skip to content

Commit 4cd47b9

Browse files
committed
some changes for c++
1 parent 28bbb65 commit 4cd47b9

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

docs/debugger/how-to-use-the-threads-window.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ manager: douge
2020
ms.workload:
2121
- "multiple"
2222
---
23-
# Walkthrough: Debug a multithreaded app
23+
# Walkthrough: Debug a multithreaded app using the Threads window
2424

2525
Several Visual Studio user interface elements help you debug multithreaded apps. This article introduces multithreaded debugging features in the code editor window, **Debug Location** toolbar, and **Threads** window. For information about other tools for debugging multithreaded apps, see [Get started debugging multithreaded apps](../debugger/get-started-debugging-multithreaded-apps.md).
2626

@@ -32,13 +32,15 @@ Create the following multithreaded app project to use in this tutorial:
3232

3333
1. In Visual Studio, select **File** > **New** > **Project**.
3434

35-
1. In the **New Project** dialog box, select **Visual C#** > **Console App (.NET Framework)**.
35+
1. In the **New Project** dialog box:
36+
- For a C# app, select **Visual C#** > **Console App (.NET Framework)**.
37+
- For a C++ app, select **Visual C++** > **Windows Console Application**.
3638

3739
1. Name the app MyThreadWalkthroughApp, and then select **OK**.
3840

39-
The new project appears in **Solution Explorer**, and a source file called *Program.cs* opens in the source code window.
41+
The new project appears in **Solution Explorer**, and a source file called *Program.cs* or *MyThreadWalkthroughApp.cpp* opens in the source code window.
4042

41-
1. Replace the code in the source file with the example code from [Create a thread](/dotnet/standard/threading/creating-threads-and-passing-data-at-start-time.md#create-a-thread).
43+
1. Replace the code in the source file with the C# or C++ example code from [Get started debugging multithreaded apps](../debugger/get-started-debugging-multithreaded-apps.md).
4244

4345
1. Select **File** > **Save All**.
4446

@@ -47,11 +49,16 @@ Create the following multithreaded app project to use in this tutorial:
4749
1. Find the following lines in the source code:
4850

4951
```csharp
50-
Thread.Sleep(3000);
51-
Console.WriteLine();
52+
Thread.Sleep(3000);
53+
Console.WriteLine();
5254
```
5355

54-
Set a breakpoint on the `Console.WriteLine();` line by clicking in the left gutter, or selecting the line and pressing **F9**.
56+
```C++
57+
Thread::Sleep(3000);
58+
Console.WriteLine();
59+
```
60+
61+
1. Set a breakpoint on the `Console.WriteLine();` line by clicking in the left gutter, or selecting the line and pressing **F9**.
5562
5663
The breakpoint appears as a red circle in the left gutter next to the code line.
5764
@@ -63,13 +70,9 @@ Create the following multithreaded app project to use in this tutorial:
6370
6471
## Examine thread markers
6572
66-
1. In the source code, locate the following line:
67-
68-
```csharp
69-
Thread.Sleep(3000);
70-
```
73+
1. In the source code, locate the `Console.WriteLine();` line.
7174
72-
1. Right-click in the **Threads** window, and select **Show Threads in Source** ![Show Threads in Source](../debugger/media/dbg-multithreaded-show-threads.png "ThreadMarker") from the menu.
75+
1. Right-click in the **Threads** window, and select **Show Threads in Source** ![Show Threads in Source](../debugger/media/dbg-multithreaded-show-threads.png "ThreadMarker") from the menu.
7376
7477
The gutter next to the source code line now displays a *thread marker* icon ![Thread Marker](../debugger/media/dbg-thread-marker.png "Thread Marker"). The thread marker indicates that a thread is stopped at this location. If there is more than one stopped thread at the location, the ![multiple threads](../debugger/media/dbg-multithreaded-show-threads.png "multiple threads") icon appears.
7578

0 commit comments

Comments
 (0)