-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slice a copy of outstanding callbacks.
Take a slice of the callbacks before invoking the turnstile, instead of calling all callbacks after invoking the turnstile. That's a race condition because the callback could have been added after the turnstile was entered. Closes #19.
- Loading branch information
1 parent
152fd98
commit f743452
Showing
3 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Issue by Issue | ||
|
||
* Slice a copy of outstanding callbacks. #19. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
require('proof')(1, function (step, assert) { | ||
var results = [], pause | ||
var turnstile = require('../..')(function (callback) { | ||
require('proof')(2, function (step, assert) { | ||
var results = [], turnstile | ||
turnstile = require('../..')(function (callback) { | ||
throw new Error('abend') | ||
}, function (error) { | ||
assert(error.message, 'abend', 'caught') | ||
}) | ||
turnstile() | ||
turnstile = require('../..')(function (callback) { | ||
callback(new Error('abend')) | ||
}) | ||
try { | ||
turnstile(function (error) { | ||
throw error | ||
}) | ||
} catch (error) { | ||
assert(error.message, 'abend', 'uncaught') | ||
} | ||
}) |