go-sql-driver/mysql — pull request #166 by thejerf (2013-11-08 16:39:42+00:00)
Title: Fix the TestConcurrent test to pass Go's race detection.

Running the race detection against the previous version of this test reveals
race conditions surrounding the "max" variable. Subsequent work in this patch
also revealed race conditions surrounding canStop.

Additionally, it is not valid to call *Testing.FailNow in goroutines started
by the tests.

This should retain the meaning of the original test while cleaning up the race
conditions and guaranteeing the *Testing.Fatal call occurs in the correct
goroutine.

It also forces each connection to successfully SELECT 1 at least once. In
previous versions of this test it is entirely possible for canStop to be set to
true before any queries have been run.