CS311: Initial threaded version.

Currently doesn't continue adding threads.
CS311: Fix issue with integer overflow.

Add mutex locking for whole unsigned int.