-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.questionIssues that look for answers.Issues that look for answers.
Description
This section says:
// WARNING! DO NOT USE! BAD UNSAFE HAZARD! function maybeSync(arg, cb) { if (arg) { cb(); return; } fs.stat('file', cb); }This API is hazardous because in the following case:
maybeSync(true, () => { foo(); }); bar();It is not clear whether
foo()
orbar()
will be called first.
For me, if arg
is true
, the order is unambiguously maybeSync() -> cb() -> foo() -> bar()
, i.e. no async at all. What do I miss?
Metadata
Metadata
Assignees
Labels
processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.questionIssues that look for answers.Issues that look for answers.