Skip to content

Commit 091d839

Browse files
committed
fixed #1188
1 parent 991f6fd commit 091d839

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

docs/debugger/get-started-debugging-multithreaded-apps.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,27 @@ To begin this tutorial, you need a multithreaded application project. Follow the
106106
#include <iostream>
107107
#include <vector>
108108

109+
using namespace;
110+
109111
int count = 0;
110112

111113
void doSomeWork() {
112114

113-
std::cout << "The doSomeWork function is running on another thread." << std::endl;
115+
cout << "The doSomeWork function is running on another thread." << endl;
114116
int data = count++;
115117
// Pause for a moment to provide a delay to make
116118
// threads more apparent.
117-
std::this_thread::sleep_for(std::chrono::seconds(3));
118-
std::cout << "The function called by the worker thread has ended." << std::endl;
119+
this_thread::sleep_for(chrono::seconds(3));
120+
cout << "The function called by the worker thread has ended." << endl;
119121
}
120122

121123
int main() {
122-
std::vector<std::thread> threads;
124+
vector<thread> threads;
123125

124126
for (int i = 0; i < 10; ++i) {
125127

126-
threads.push_back(std::thread(doSomeWork));
127-
std::cout << "The Main() thread calls this after starting the new thread" << std::endl;
128+
threads.push_back(thread(doSomeWork));
129+
cout << "The Main() thread calls this after starting the new thread" << endl;
128130
}
129131

130132
for (auto& thread : threads) {
@@ -198,17 +200,18 @@ To begin this tutorial, you need a multithreaded application project. Follow the
198200
```
199201

200202
```C++
201-
Thread::Sleep(3000);
202-
Console.WriteLine();
203+
this_thread::sleep_for(chrono::seconds(3));
204+
cout << "The function called by the worker thread has ended." << endl;
203205
```
206+
204207
```VB
205208
Thread.Sleep(3000)
206209
Console.WriteLine()
207210
```
208211

209212
#### To start debugging
210213

211-
1. Click in the left gutter of the `Thread.Sleep` or `Thread::Sleep` statement to insert a new breakpoint.
214+
1. Click in the left gutter of the `Thread.Sleep` or `this_thread::sleep_for` statement to insert a new breakpoint.
212215

213216
In the gutter on the left side of the source code editor, a red circle appears. This indicates that a breakpoint is now set at this location.
214217

@@ -226,7 +229,7 @@ To begin this tutorial, you need a multithreaded application project. Follow the
226229
```
227230

228231
```C++
229-
Thread::Sleep(3000);
232+
this_thread::sleep_for(chrono::seconds(3));
230233
```
231234

232235
```VB
@@ -255,7 +258,7 @@ In the **Parallel Stacks** window, you can switch between a Threads view and (fo
255258

256259
![Parallel Stacks Window](../debugger/media/dbg-multithreaded-parallel-stacks.png "ParallelStacksWindow")
257260

258-
In this example, from left to right we get this information:
261+
In this example, from left to right we get this information for managed code:
259262

260263
- The Main thread (left side) has stopped on `Thread.Start` (the stop point is indicated by the thread marker icon ![Thread Marker](../debugger/media/dbg-thread-marker.png "ThreadMarker")).
261264
- Two threads have entered the `ServerClass.InstanceMethod`, one of which is the current thread (yellow arrow), while the other thread has stopped in `Thread.Sleep`.

0 commit comments

Comments
 (0)