Skip to content

Commit b1db13b

Browse files
codebytereaddaleax
authored andcommitted
src: add get/set pair for env context awareness
PR-URL: #35024 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent ae800da commit b1db13b

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
@@ -509,6 +509,14 @@ inline bool Environment::abort_on_uncaught_exception() const {
509509
return options_->abort_on_uncaught_exception;
510510
}
511511

512+
inline void Environment::set_force_context_aware(bool value) {
513+
options_->force_context_aware = value;
514+
}
515+
516+
inline bool Environment::force_context_aware() const {
517+
return options_->force_context_aware;
518+
}
519+
512520
inline void Environment::set_abort_on_uncaught_exception(bool value) {
513521
options_->abort_on_uncaught_exception = value;
514522
}

src/env.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,9 @@ class Environment : public MemoryRetainer {
973973
void PrintSyncTrace() const;
974974
inline void set_trace_sync_io(bool value);
975975

976+
inline void set_force_context_aware(bool value);
977+
inline bool force_context_aware() const;
978+
976979
// This stores whether the --abort-on-uncaught-exception flag was passed
977980
// to Node.
978981
inline bool abort_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
return false;

0 commit comments

Comments
 (0)