mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
[runtime] Add a wrapper around atexit () since it is missing on some android versions.
This commit is contained in:
1 parent
09d18d4f47
commit
7138ab117f
6 files changed
+18
-5
No files matched your search
@@ -176,7 +176,6 @@ typedef struct _GMemChunk GMemChunk;
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
#define g_atexit(func) ((void) atexit (func))
|
||||
|
||||
const gchar * g_getenv(const gchar *variable);
|
||||
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <mono/io-layer/process-private.h>
|
||||
|
||||
#include <mono/utils/mono-mutex.h>
|
||||
#include <mono/utils/mono-proclib.h>
|
||||
#undef DEBUG_REFS
|
||||
|
||||
#if 0
|
||||
@@ -286,12 +287,12 @@ wapi_init (void)
|
||||
|
||||
wapi_processes_init ();
|
||||
|
||||
/* Using g_atexit here instead of an explicit function call in
|
||||
/* Using atexit here instead of an explicit function call in
|
||||
* a cleanup routine lets us cope when a third-party library
|
||||
* calls exit (eg if an X client loses the connection to its
|
||||
* server.)
|
||||
*/
|
||||
g_atexit (handle_cleanup);
|
||||
mono_atexit (handle_cleanup);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <mono/metadata/metadata.h>
|
||||
#include <mono/metadata/threadpool.h>
|
||||
#include <mono/utils/mono-signal-handler.h>
|
||||
#include <mono/utils/mono-proclib.h>
|
||||
|
||||
/* On solaris, curses.h must come before both termios.h and term.h */
|
||||
#ifdef HAVE_CURSES_H
|
||||
@@ -502,7 +503,7 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow
|
||||
if (teardown != NULL)
|
||||
teardown_str = mono_string_to_utf8 (teardown);
|
||||
|
||||
atexit (tty_teardown);
|
||||
mono_atexit (tty_teardown);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -645,7 +645,7 @@ mono_shared_area (void)
|
||||
header->stats_start = sizeof (SAreaHeader);
|
||||
header->stats_end = sizeof (SAreaHeader);
|
||||
|
||||
atexit (mono_shared_area_remove);
|
||||
mono_atexit (mono_shared_area_remove);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -664,3 +664,13 @@ mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error)
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
mono_atexit (void (*func)(void))
|
||||
{
|
||||
#ifdef PLATFORM_ANDROID
|
||||
/* Some versions of android libc doesn't define atexit () */
|
||||
return 0;
|
||||
#else
|
||||
return atexit (func);
|
||||
#endif
|
||||
}
|
||||
@@ -52,5 +52,7 @@ int mono_process_current_pid (void) MONO_INTERNAL;
|
||||
int mono_cpu_count (void) MONO_INTERNAL;
|
||||
gint64 mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error) MONO_INTERNAL;
|
||||
|
||||
int mono_atexit (void (*func)(void)) MONO_INTERNAL;
|
||||
|
||||
#endif /* __MONO_PROC_LIB_H__ */
|
||||
|
||||
Reference in new issue
Block a user