blob: 3cd3485c56fb4c5a8f2e1226778c4003f12096f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/**
* \file
* native threadpool worker
*
* Author:
* Ludovic Henry (ludovic.henry@xamarin.com)
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <stdlib.h>
#define _USE_MATH_DEFINES // needed by MSVC to define math constants
#include <math.h>
#include <config.h>
#include <glib.h>
#ifndef ENABLE_NETCORE
#include <mono/metadata/threadpool.h>
#include <mono/metadata/threadpool-worker.h>
static MonoThreadPoolWorkerCallback tp_cb;
static gboolean cb_scheduled;
void
mono_threadpool_worker_init (MonoThreadPoolWorkerCallback callback)
{
tp_cb = callback;
}
void
mono_threadpool_worker_cleanup (void)
{
}
gint32
mono_threadpool_worker_get_min (void)
{
return 1;
}
gboolean
mono_threadpool_worker_set_min (gint32 value)
{
return value == 1;
}
gint32
mono_threadpool_worker_get_max (void)
{
return 1;
}
gboolean
mono_threadpool_worker_set_max (gint32 value)
{
return value == 1;
}
static void
fire_tp_callback (void)
{
cb_scheduled = FALSE;
tp_cb ();
}
void
mono_threadpool_worker_request (void)
{
if (!cb_scheduled)
mono_threads_schedule_background_job (fire_tp_callback);
cb_scheduled = TRUE;
}
gboolean
mono_threadpool_worker_notify_completed (void)
{
return FALSE;
}
#endif
|