Skip to content

jjblum/myFirstThreading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b0c1ee7 · Dec 2, 2013

History

6 Commits
Dec 2, 2013
Dec 2, 2013
Dec 2, 2013
Dec 2, 2013
Dec 2, 2013
Dec 2, 2013
Dec 2, 2013
Dec 2, 2013

Repository files navigation

Basic threading example shows the addition race between a for-loop in main() vs. an SDL-based thread while-loop.

There is a parent, general thread class CThread that has as much generality as possible so that wildly different types of subclass threads can be designed. The subclass thread included here is CThread_Add, where an input integer is increased by increments of 1 until the thread is stopped.

The results are highly dependent on the ratio of the sleep durations in the for- and while- loop. Because the thread is slightly slower than the main() for-loop, it may be stopped before it can reach the maximum number of loops possible, given the for-loop's usleep() command.

About

Basic C++ SDL-based threading example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published