少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
 * \file
 * Low level access to thread state.
 *
 * Author:
 *    Rodrigo Kumpera (kumpera@gmail.com)
 *
 * (C) 2015 Xamarin
 */
 
#ifndef __MONO_THREADS_API_H__
#define __MONO_THREADS_API_H__
 
#include <glib.h>
#include <mono/utils/mono-publib.h>
 
MONO_BEGIN_DECLS
 
/*
>>>> WARNING WARNING WARNING <<<<
 
This API is experimental. It will eventually be required to properly use the rest of the raw-omp embedding API.
*/
 
MONO_API gpointer
mono_threads_enter_gc_unsafe_region (gpointer* stackdata);
 
MONO_API void
mono_threads_exit_gc_unsafe_region (gpointer cookie, gpointer* stackdata);
 
MONO_API gpointer
mono_threads_enter_gc_unsafe_region_unbalanced (gpointer* stackdata);
 
MONO_API void
mono_threads_exit_gc_unsafe_region_unbalanced (gpointer cookie, gpointer* stackdata);
 
MONO_API void
mono_threads_assert_gc_unsafe_region (void);
 
 
 
MONO_API gpointer
mono_threads_enter_gc_safe_region (gpointer *stackdata);
 
MONO_API void
mono_threads_exit_gc_safe_region (gpointer cookie, gpointer *stackdata);
 
MONO_API gpointer
mono_threads_enter_gc_safe_region_unbalanced (gpointer *stackdata);
 
MONO_API void
mono_threads_exit_gc_safe_region_unbalanced (gpointer cookie, gpointer *stackdata);
 
MONO_API void
mono_threads_assert_gc_safe_region (void);
 
/*
Use those macros to limit regions of code that interact with managed memory or use the embedding API.
This will put the current thread in GC Unsafe mode.
 
For further explanation of what can and can't be done in GC unsafe mode:
http://www.mono-project.com/docs/advanced/runtime/docs/coop-suspend/#gc-unsafe-mode
*/
#define MONO_ENTER_GC_UNSAFE    \
    do {    \
        gpointer __gc_unsafe_dummy;    \
        gpointer __gc_unsafe_cookie = mono_threads_enter_gc_unsafe_region (&__gc_unsafe_dummy)
 
#define MONO_EXIT_GC_UNSAFE    \
        mono_threads_exit_gc_unsafe_region    (__gc_unsafe_cookie, &__gc_unsafe_dummy);    \
    } while (0)
 
#define MONO_ENTER_GC_UNSAFE_UNBALANCED    \
    do {    \
        gpointer __gc_unsafe_unbalanced_dummy;    \
        gpointer __gc_unsafe_unbalanced_cookie = mono_threads_enter_gc_unsafe_region_unbalanced (&__gc_unsafe_unbalanced_dummy)
 
#define MONO_EXIT_GC_UNSAFE_UNBALANCED    \
        mono_threads_exit_gc_unsafe_region_unbalanced    (__gc_unsafe_unbalanced_cookie, &__gc_unsafe_unbalanced_dummy);    \
    } while (0)
 
#define MONO_ENTER_GC_SAFE    \
    do {    \
        gpointer __gc_safe_dummy;    \
        gpointer __gc_safe_cookie = mono_threads_enter_gc_safe_region (&__gc_safe_dummy)
 
#define MONO_EXIT_GC_SAFE    \
        mono_threads_exit_gc_safe_region (__gc_safe_cookie, &__gc_safe_dummy);    \
    } while (0)
 
#define MONO_ENTER_GC_SAFE_UNBALANCED    \
    do {    \
        gpointer __gc_safe_unbalanced_dummy;    \
        gpointer __gc_safe_unbalanced_cookie = mono_threads_enter_gc_safe_region_unbalanced (&__gc_safe_unbalanced_dummy)
 
#define MONO_EXIT_GC_SAFE_UNBALANCED    \
        mono_threads_exit_gc_safe_region_unbalanced (__gc_safe_unbalanced_cookie, &__gc_safe_unbalanced_dummy);    \
    } while (0)
 
MONO_END_DECLS
 
#endif /* __MONO_LOGGER_H__ */