Skip to content

Commit fb3f7ab

Browse files
committed
remove old emscripten keepalive workaround hack
1 parent 9b8297f commit fb3f7ab

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

src/mono/mono/metadata/threads.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,11 +1116,6 @@ fire_attach_profiler_events (MonoNativeThreadId tid)
11161116
}
11171117

11181118

1119-
#ifdef MONO_EMSCRIPTEN_KEEPALIVE_WORKAROUND_HACK
1120-
/* See ves_icall_System_Threading_WebWorkerEventLoop_KeepalivePopInternal */
1121-
__thread uint mono_emscripten_keepalive_hack_count;
1122-
#endif
1123-
11241119
static guint32 WINAPI
11251120
start_wrapper_internal (StartInfo *start_info, gsize *stack_ptr)
11261121
{
@@ -4979,34 +4974,13 @@ ves_icall_System_Threading_LowLevelLifoSemaphore_ReleaseInternal (gpointer sem_p
49794974
void
49804975
ves_icall_System_Threading_WebWorkerEventLoop_KeepalivePushInternal (void)
49814976
{
4982-
#ifdef MONO_EMSCRIPTEN_KEEPALIVE_WORKAROUND_HACK
4983-
mono_emscripten_keepalive_hack_count++;
4984-
#endif
49854977
emscripten_runtime_keepalive_push();
49864978
}
49874979

49884980
void
49894981
ves_icall_System_Threading_WebWorkerEventLoop_KeepalivePopInternal (void)
49904982
{
49914983
emscripten_runtime_keepalive_pop();
4992-
#ifdef MONO_EMSCRIPTEN_KEEPALIVE_WORKAROUND_HACK
4993-
/* This is a BAD IDEA:
4994-
*
4995-
* 1. We don't know if there were non-mono callers of emscripten_runtime_keepalive_push. We
4996-
* could be dropping a thread that was meant to stay alive.
4997-
*
4998-
* 2. mono_thread_exit while we have managed frames on the stack means we might leak
4999-
* resource since finally clauses didn't run. Also the mono interpreter doesn't really get
5000-
* a chance to clean up.
5001-
*
5002-
*
5003-
*/
5004-
mono_emscripten_keepalive_hack_count--;
5005-
if (!mono_emscripten_keepalive_hack_count) {
5006-
g_warning ("thread %p mono keepalive count is zero, detaching\n", (void*)(intptr_t)pthread_self());
5007-
mono_thread_exit();
5008-
}
5009-
#endif
50104984
}
50114985

50124986
extern int mono_wasm_eventloop_has_unsettled_interop_promises(void);

src/mono/mono/utils/mono-threads-wasm.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,6 @@
1111
#include <glib.h>
1212
#include <mono/utils/mono-threads.h>
1313

14-
#if defined(HOST_BROWSER) && !defined(DISABLE_THREADS)
15-
#include <emscripten/version.h>
16-
/* for Emscripten < 3.1.33,
17-
* emscripten_runtime_keepalive_push()/emscripten_runtime_keepalive_pop()/emscripten_keepalive_check()
18-
* are no-ops when -sNO_EXIT_RUNTIME=1 (the default). Do our own bookkeeping when we can. Note
19-
* that this is a HACK that is very sensitive to code that actually cares about this bookkeeping.
20-
*
21-
* Specifically we need https://github.com/emscripten-core/emscripten/commit/0c2f5896b839e25fee9763a9ac9c619f359988f4
22-
*/
23-
#if (__EMSCRIPTEN_major__ < 3) || (__EMSCRIPTEN_major__ == 3 && __EMSCRIPTEN_minor__ < 1) || (__EMSCRIPTEN_major__ == 3 && __EMSCRIPTEN_minor__ == 1 && __EMSCRIPTEN_tiny__ < 33)
24-
#define MONO_EMSCRIPTEN_KEEPALIVE_WORKAROUND_HACK 1
25-
#endif
26-
#endif /*HOST_BROWSER && !DISABLE_THREADS*/
27-
2814
#ifdef HOST_WASM
2915

3016
/*

0 commit comments

Comments
 (0)