92
edits
Changes
→Case B - Using the Parallel Stacks and the Parallel Watch Window
[[File:Parallelwatch-step2-callstack.PNG|300px|center|Synced up]]
[[File:Parallelwatch-step2b.PNG|200px|center|Synced up]]
As we step through each breakpoint, we see the same thing happen with the other worker threads once they pick up a function call, but although the i value gets set once they enter the functions of each of the different calls, when the stack frame goes back to the main method to get ready to call the next function, we don't see the i value as 1 for all threads, because the stack frame from the main method only sees the Main Thread's i set as 1, from the main method. The Parallel Watch only lets us see the pertinent threads for the current stack frame we are on. So we will only see all threads in the same window if we are on a stack frame that belongs from the main method. But as we step into a stack frame that is within one of the functions, we will see the thread that is handling that function, and the i value at that point. This window is not like the Parallel Stacks window where you can see all threads' positions simultaneously.
As we step to the breakpoint that is the return line for the foo(i) function, which Main Thread was working on, we can see the changed value for i:
[[File:Parallelwatch-step3.PNG|200px|center|Foo(i)]]
Foo() had incremented i by 1.
Now let's see we don't care to see all threads based on all of the breakpoints we had put. Let's say we just want to focus on the Main Thread's work, as well as the thread that took the doo() function, which according to the Parallel Stacks Window, we can see Worker 1 took up. So in the Threads we will flag those two threads:
[[File:Parallelwatch-step4-flags.PNG|300px|center|Foo(i)]]
And then in our Parallel Watch Window, we will check on the Flag icon in the top corner, which will only watch the threads we have flagged:
[[File:Parallelwatch-step4-flags-checked.PNG|300px|center|Foo(i)]]
==Case C==