[metadata] Fix leaks when handling a few attributes (#16675)
[mono-project.git] / mono / metadata / threads.h
blob65020eb0398c25c0d999158ceaa807dcac173c96
1 /**
2 * \file
3 * Threading API
5 * Author:
6 * Dick Porter (dick@ximian.com)
7 * Patrik Torstensson (patrik.torstensson@labs2.com)
9 * (C) 2001 Ximian, Inc
12 #ifndef _MONO_METADATA_THREADS_H_
13 #define _MONO_METADATA_THREADS_H_
15 #include <mono/utils/mono-publib.h>
16 #include <mono/metadata/object.h>
17 #include <mono/metadata/appdomain.h>
19 MONO_BEGIN_DECLS
21 /* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */
22 typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread);
24 MONO_API void mono_thread_init (MonoThreadStartCB start_cb,
25 MonoThreadAttachCB attach_cb);
26 MONO_API void mono_thread_cleanup (void);
27 MONO_API void mono_thread_manage(void);
29 MONO_API MonoThread *mono_thread_current (void);
31 MONO_API void mono_thread_set_main (MonoThread *thread);
32 MONO_API MonoThread *mono_thread_get_main (void);
34 MONO_API MONO_RT_EXTERNAL_ONLY void mono_thread_stop (MonoThread *thread);
36 MONO_API void mono_thread_new_init (intptr_t tid, void* stack_start,
37 void* func);
39 MONO_API MONO_RT_EXTERNAL_ONLY void
40 mono_thread_create (MonoDomain *domain, void* func, void* arg);
42 MONO_API MonoThread *mono_thread_attach (MonoDomain *domain);
43 MONO_API void mono_thread_detach (MonoThread *thread);
44 MONO_API void mono_thread_exit (void);
46 MONO_API char *mono_thread_get_name_utf8 (MonoThread *thread);
47 MONO_API int32_t mono_thread_get_managed_id (MonoThread *thread);
49 MONO_API void mono_thread_set_manage_callback (MonoThread *thread, MonoThreadManageCallback func);
51 MONO_API void mono_threads_set_default_stacksize (uint32_t stacksize);
52 MONO_API uint32_t mono_threads_get_default_stacksize (void);
54 MONO_API void mono_threads_request_thread_dump (void);
56 MONO_API mono_bool mono_thread_is_foreign (MonoThread *thread);
58 MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
59 mono_thread_detach_if_exiting (void);
61 MONO_END_DECLS
63 #endif /* _MONO_METADATA_THREADS_H_ */