Skip to content

Instantly share code, notes, and snippets.

@deepal
Created June 15, 2019 22:22
Show Gist options
  • Select an option

  • Save deepal/dcc45d39f172902a41bfa35edcb39587 to your computer and use it in GitHub Desktop.

Select an option

Save deepal/dcc45d39f172902a41bfa35edcb39587 to your computer and use it in GitHub Desktop.
// Constructor of Async resource
AsyncResource::AsyncResource(Isolate* isolate,
Local<Object> resource,
const char* name,
async_id trigger_async_id)
: env_(Environment::GetCurrent(isolate)),
resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id);
}
// Destructor of Async resource
AsyncResource::~AsyncResource() {
EmitAsyncDestroy(env_, async_context_);
resource_.Reset();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment