[2020-02] Fix leak in assembly-specific dllmap lookups (#21053)
[mono-project.git] / mono / metadata / threadpool-worker-wasm.c
blob3cd3485c56fb4c5a8f2e1226778c4003f12096f1
1 /**
2 * \file
3 * native threadpool worker
5 * Author:
6 * Ludovic Henry (ludovic.henry@xamarin.com)
8 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
9 */
11 #include <stdlib.h>
12 #define _USE_MATH_DEFINES // needed by MSVC to define math constants
13 #include <math.h>
14 #include <config.h>
15 #include <glib.h>
17 #ifndef ENABLE_NETCORE
19 #include <mono/metadata/threadpool.h>
20 #include <mono/metadata/threadpool-worker.h>
22 static MonoThreadPoolWorkerCallback tp_cb;
23 static gboolean cb_scheduled;
25 void
26 mono_threadpool_worker_init (MonoThreadPoolWorkerCallback callback)
28 tp_cb = callback;
31 void
32 mono_threadpool_worker_cleanup (void)
36 gint32
37 mono_threadpool_worker_get_min (void)
39 return 1;
42 gboolean
43 mono_threadpool_worker_set_min (gint32 value)
45 return value == 1;
48 gint32
49 mono_threadpool_worker_get_max (void)
51 return 1;
54 gboolean
55 mono_threadpool_worker_set_max (gint32 value)
57 return value == 1;
60 static void
61 fire_tp_callback (void)
63 cb_scheduled = FALSE;
64 tp_cb ();
67 void
68 mono_threadpool_worker_request (void)
70 if (!cb_scheduled)
71 mono_threads_schedule_background_job (fire_tp_callback);
72 cb_scheduled = TRUE;
75 gboolean
76 mono_threadpool_worker_notify_completed (void)
78 return FALSE;
81 #endif