Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Threading Demo What is here Copyright © 2017 Curt Hill.

Similar presentations


Presentation on theme: "The Threading Demo What is here Copyright © 2017 Curt Hill."— Presentation transcript:

1 The Threading Demo What is here Copyright © 2017 Curt Hill

2 Introduction This presentation is on the Dev Threading demo
It puts the things to notice in one place As such it introduces nothing new or testable This demonstrates CreateThread, CreateProcess, Sleep and critical sections Copyright © 2017 Curt Hill

3 Overview The demo is the standard ggFrm with the normal files
There are four additional: Buffer.cpp and .h Stuff.cpp and .h The buffer is a concurrent producer and consumer problem Stuff is to demonstrate the presence or absence of race errors Copyright © 2017 Curt Hill

4 Threading and Synchronization
There is a #define that determines whether to use critical sections It is in buffer.h and named CRITICAL Commenting it out should provoke race errors Copyright © 2017 Curt Hill

5 First Button The WxButton1Click0 event handler is where we start
It does the CreateThread in a loop limited by user defined input It creates all of these suspended It then starts them all at as close to one time as is practicable The thread function is func Defined in Stuff.cpp and .h This is defined only to demonstrate race errors Copyright © 2017 Curt Hill

6 Thread func This function must be a WINAPI function
It drops into a big for loop It then increments and tests two integers It then does a sleep for a millisecond If the critical section is enabled there should be no race errors to find Copyright © 2017 Curt Hill

7 Stuff Contains several integers and critical sections
Stuff is to increment these in succession, so that they are always within one of each other, but usually equal The constructor initializes the critical section Copyright © 2017 Curt Hill

8 Producer / Consumer The second button starts a producer and consumer problem with multiple threads Buffer contains the class and thread function Copyright © 2017 Curt Hill

9 Starting a process The last button does a common dialog box to start a new program Its event handler does a CreateProcess Copyright © 2017 Curt Hill

10 Finally Let’s now look at the demo Copyright © 2017 Curt Hill


Download ppt "The Threading Demo What is here Copyright © 2017 Curt Hill."

Similar presentations


Ads by Google