Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mono/browser/runtime/loader/exit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import MonoWasmThreads from "consts:monoWasmThreads";
import WasmEnableThreads from "consts:monoWasmThreads";

import { ENVIRONMENT_IS_NODE, ENVIRONMENT_IS_WEB, ENVIRONMENT_IS_WORKER, INTERNAL, emscriptenModule, loaderHelpers, mono_assert, runtimeHelpers } from "./globals";
import { mono_log_debug, mono_log_error, mono_log_info_no_prefix, mono_log_warn, teardown_proxy_console } from "./logging";
Expand All @@ -16,7 +16,7 @@ export function is_runtime_running() {

export function assert_runtime_running() {
if (!is_exited()) {
if (MonoWasmThreads && ENVIRONMENT_IS_WORKER) {
if (WasmEnableThreads && ENVIRONMENT_IS_WORKER) {
mono_assert(runtimeHelpers.runtimeReady, "The WebWorker is not attached to the runtime. See https://github.com/dotnet/runtime/blob/main/src/mono/wasm/threads.md#JS-interop-on-dedicated-threads");
} else {
mono_assert(runtimeHelpers.runtimeReady, ".NET runtime didn't start yet. Please call dotnet.create() first.");
Expand Down Expand Up @@ -151,7 +151,7 @@ export function mono_exit(exit_code: number, reason?: any): void {
}

function set_exit_code_and_quit_now(exit_code: number, reason?: any): void {
if (MonoWasmThreads && ENVIRONMENT_IS_WORKER && runtimeHelpers.runtimeReady && runtimeHelpers.nativeAbort) {
if (WasmEnableThreads && ENVIRONMENT_IS_WORKER && runtimeHelpers.runtimeReady && runtimeHelpers.nativeAbort) {
// note that the reason is not passed to UI thread
runtimeHelpers.runtimeReady = false;
runtimeHelpers.nativeAbort(reason);
Expand Down
10 changes: 5 additions & 5 deletions src/mono/browser/runtime/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function instantiateWasmWorker(
imports: WebAssembly.Imports,
successCallback: InstantiateWasmSuccessCallback
): Promise<void> {
if (!MonoWasmThreads) return;
if (!WasmEnableThreads) return;
// wait for the config to arrive by message from the main thread
await loaderHelpers.afterConfigLoaded.promise;

Expand Down Expand Up @@ -169,7 +169,7 @@ function preInit(userPreInit: (() => void)[]) {
}

async function preInitWorkerAsync() {
if (!MonoWasmThreads) return;
if (!WasmEnableThreads) return;
const mark = startMeasure();
try {
mono_log_debug("preInitWorker");
Expand All @@ -193,7 +193,7 @@ async function preInitWorkerAsync() {

// runs for each re-attached worker
export function preRunWorker() {
if (!MonoWasmThreads) return;
if (!WasmEnableThreads) return;
const mark = startMeasure();
try {
jiterpreter_allocate_tables(); // this will return quickly if already allocated
Expand Down Expand Up @@ -362,7 +362,7 @@ async function postRunAsync(userpostRun: (() => void)[]) {

// runs for each re-detached worker
export function postRunWorker() {
if (!MonoWasmThreads) return;
if (!WasmEnableThreads) return;
const mark = startMeasure();
try {
if (runtimeHelpers.proxy_context_gc_handle) {
Expand Down Expand Up @@ -664,7 +664,7 @@ export function mono_wasm_set_main_args(name: string, allRuntimeArguments: strin
/// 2. Emscripten does not run any event but preInit in the workers.
/// 3. At the point when this executes there is no pthread assigned to the worker yet.
export async function configureWorkerStartup(module: DotnetModuleInternal): Promise<void> {
if (!MonoWasmThreads) return;
if (!WasmEnableThreads) return;

initWorkerThreadEvents();
currentWorkerThreadEvents.addEventListener(dotnetPthreadCreated, () => {
Expand Down