| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 79a7a17 commit ce3866b
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,27 +11,28 @@ const async_wrap = process.binding('async_wrap'); | |||
| 11 | 11 | * the various asynchronous states of the application. These are: | |
| 12 | 12 | * kExecutionAsyncId: The async_id assigned to the resource responsible for the | |
| 13 | 13 | * current execution stack. | |
| 14 | - * kTriggerAsyncId: The trigger_async_id of the resource responsible for | ||
| 15 | - * the current execution stack. | ||
| 14 | + * kTriggerAsyncId: The async_id of the resource that caused (or 'triggered') | ||
| 15 | + * the resource corresponding to the current execution stack. | ||
| 16 | 16 | * kAsyncIdCounter: Incremental counter tracking the next assigned async_id. | |
| 17 | 17 | * kDefaultTriggerAsyncId: Written immediately before a resource's constructor | |
| 18 | - * that sets the value of the init()'s triggerAsyncId. The order of | ||
| 19 | - * retrieving the triggerAsyncId value is passing directly to the | ||
| 20 | - * constructor -> value set in kDefaultTriggerAsyncId -> executionAsyncId of | ||
| 21 | - * the current resource. | ||
| 18 | + * that sets the value of the init()'s triggerAsyncId. The precedence order | ||
| 19 | + * of retrieving the triggerAsyncId value is: | ||
| 20 | + * 1. the value passed directly to the constructor | ||
| 21 | + * 2. value set in kDefaultTriggerAsyncId | ||
| 22 | + * 3. executionAsyncId of the current resource. | ||
| 22 | 23 | * | |
| 23 | - * async_ids_fast_stack is a Float64Array that contains part of the async ID | ||
| 24 | + * async_ids_stack is a Float64Array that contains part of the async ID | ||
| 24 | 25 | * stack. Each pushAsyncIds() call adds two doubles to it, and each | |
| 25 | 26 | * popAsyncIds() call removes two doubles from it. | |
| 26 | 27 | * It has a fixed size, so if that is exceeded, calls to the native | |
| 27 | 28 | * side are used instead in pushAsyncIds() and popAsyncIds(). | |
| 28 | 29 | */ | |
| 29 | 30 | const { async_id_symbol, async_hook_fields, async_id_fields } = async_wrap; | |
| 30 | 31 | // Store the pair executionAsyncId and triggerAsyncId in a std::stack on | |
| 31 | - // Environment::AsyncHooks::ids_stack_ tracks the resource responsible for the | ||
| 32 | - // current execution stack. This is unwound as each resource exits. In the case | ||
| 33 | - // of a fatal exception this stack is emptied after calling each hook's after() | ||
| 34 | - // callback. | ||
| 32 | + // Environment::AsyncHooks::async_ids_stack_ tracks the resource responsible for | ||
| 33 | + // the current execution stack. This is unwound as each resource exits. In the | ||
| 34 | + // case of a fatal exception this stack is emptied after calling each hook's | ||
| 35 | + // after() callback. | ||
| 35 | 36 | const { pushAsyncIds: pushAsyncIds_, popAsyncIds: popAsyncIds_ } = async_wrap; | |
| 36 | 37 | // For performance reasons, only track Proimses when a hook is enabled. | |
| 37 | 38 | const { enablePromiseHook, disablePromiseHook } = async_wrap; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -554,12 +554,12 @@ void AsyncWrap::Initialize(Local<Object> target, | |||
| 554 | 554 | // this way to allow JS and C++ to read/write each value as quickly as | |
| 555 | 555 | // possible. The fields are represented as follows: | |
| 556 | 556 | // | |
| 557 | - // kAsyncUid: Maintains the state of the next unique id to be assigned. | ||
| 557 | + // kAsyncIdCounter: Maintains the state of the next unique id to be assigned. | ||
| 558 | 558 | // | |
| 559 | 559 | // kDefaultTriggerAsyncId: Write the id of the resource responsible for a | |
| 560 | 560 | // handle's creation just before calling the new handle's constructor. | |
| 561 | 561 | // After the new handle is constructed kDefaultTriggerAsyncId is set back | |
| 562 | - // to 0. | ||
| 562 | + // to -1. | ||
| 563 | 563 | FORCE_SET_TARGET_FIELD(target, | |
| 564 | 564 | "async_id_fields", | |
| 565 | 565 | env->async_hooks()->async_id_fields().GetJSArray()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments