pfraze/multicb — pull request #1 by dominictarr (2014-09-18 22:05:53+00:00)
Title: detect race conditions with interleavings

I had fixed a problem with my version of this (in ssb) the other day, about weird race conditions - which are so hard to debug, so I ran this through interleavings (this required changing the tests - need to make interleavings support tape or something)

I cases where the callbacks have all returned before the final cb has been added, that failed to callback.

This error was detected in 1/100 runs on the valid test, and 33/100 runs on the error test.
Included in this PR are fixes to both those problems.

Since I committed the tests first you can checkout the test commit and see the tests fail if you like.