blob: f94fd66e35b8f7832a6d9386117caf56b072420a (
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
|
/*
* mono-threads-api.h: 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 <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.
*/
/* Don't use those directly, use the MONO_(BEGIN|END)_EFRAME */
MONO_API void* mono_threads_enter_gc_unsafe_region (void);
MONO_API void mono_threads_exit_gc_unsafe_region (void *region_cookie);
/*
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_BEGIN_EFRAME { void *__region_cookie = mono_threads_enter_gc_unsafe_region ();
#define MONO_END_EFRAME mono_threads_exit_gc_unsafe_region (__region_cookie); }
MONO_END_DECLS
#endif /* __MONO_LOGGER_H__ */
|