Closed notcome closed 10 years ago
@notcome Thanks so much for the pull request! Stupid mistake on my part - the bug only manifests itself if you resolve a fork() prior to having initiated all the forks that you need (which almost never happens unless you're resolving synchronously like you were). That was a great catch!
Sometime it is required to call fork()(err, val) immediately. For example, if I need asynchronously load a directory and all sub-directories:
Though we could put the file/directory detecting code in loadDirectory (it is definitely better, making the programming stronger to invalid input), it would be a little confusing that
suspend
weirdly consumes fork values.A more crazy example:
In the original implementation, only the last item will be in the array.