Skip to content

Commit 789798b

Browse files
codebytererichardlau
authored andcommitted
src: add get/set pair for env context awareness
PR-URL: #35024 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 73ef3f2 commit 789798b

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

‎src/env-inl.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,14 @@ inline bool Environment::abort_on_uncaught_exception() const{
542542
return options_->abort_on_uncaught_exception;
543543
}
544544

545+
inlinevoidEnvironment::set_force_context_aware(bool value){
546+
options_->force_context_aware = value;
547+
}
548+
549+
inlineboolEnvironment::force_context_aware() const{
550+
return options_->force_context_aware;
551+
}
552+
545553
inlinevoidEnvironment::set_abort_on_uncaught_exception(bool value){
546554
options_->abort_on_uncaught_exception = value;
547555
}

‎src/env.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,9 @@ class Environment : public MemoryRetainer{
947947
voidPrintSyncTrace() const;
948948
inlinevoidset_trace_sync_io(bool value);
949949

950+
inlinevoidset_force_context_aware(bool value);
951+
inlineboolforce_context_aware() const;
952+
950953
// This stores whether the --abort-on-uncaught-exception flag was passed
951954
// to Node.
952955
inlineboolabort_on_uncaught_exception() const;

‎src/node_binding.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args){
461461

462462
if (mp != nullptr){
463463
if (mp->nm_context_register_func == nullptr){
464-
if (env->options()->force_context_aware){
464+
if (env->force_context_aware()){
465465
dlib->Close();
466466
THROW_ERR_NON_CONTEXT_AWARE_DISABLED(env);
467467
returnfalse;

0 commit comments

Comments
(0)