2005-01-24 Ben Maurer <bmaurer@ximian.com>
[mono-project.git] / mono / metadata / threads.h
blob13de557cd684b2df821f1cb5338f52649f263540
1 /*
2 * threads.h: Thread support internal calls
4 * Author:
5 * Dick Porter (dick@ximian.com)
6 * Patrik Torstensson (patrik.torstensson@labs2.com)
8 * (C) 2001 Ximian, Inc
9 */
11 #ifndef _MONO_METADATA_THREADS_H_
12 #define _MONO_METADATA_THREADS_H_
14 #include <mono/metadata/object.h>
15 #include <mono/metadata/appdomain.h>
17 typedef void (*MonoThreadCleanupFunc) (MonoThread* thread);
19 extern int mono_thread_get_abort_signal (void);
21 extern void mono_thread_init (MonoThreadStartCB start_cb,
22 MonoThreadAttachCB attach_cb);
23 extern void mono_thread_manage(void);
24 extern void mono_thread_abort_all_other_threads (void);
25 extern void mono_thread_suspend_all_other_threads (void);
27 extern void mono_thread_push_appdomain_ref (MonoDomain *domain);
28 extern void mono_thread_pop_appdomain_ref (void);
29 extern gboolean mono_thread_has_appdomain_ref (MonoThread *thread, MonoDomain *domain);
31 extern MonoException * mono_thread_get_pending_exception (void);
33 extern gboolean mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout);
34 extern void mono_threads_clear_cached_culture (MonoDomain *domain);
36 extern MonoThread *mono_thread_current (void);
38 extern void mono_thread_set_main (MonoThread *thread);
39 extern MonoThread *mono_thread_get_main (void);
41 extern void mono_thread_stop (MonoThread *thread);
43 typedef struct {
44 gpointer (* thread_start_compile_func) (MonoMethod *delegate);
45 void (* thread_created) (guint32 tid, gpointer stack_start, gpointer func);
46 void (* start_resume) (guint32 tid);
47 void (* end_resume) (guint32 tid);
48 } MonoThreadCallbacks;
50 extern void mono_install_thread_callbacks (MonoThreadCallbacks *callbacks);
52 extern void mono_thread_new_init (guint32 tid, gpointer stack_start,
53 gpointer func);
54 extern void mono_thread_create (MonoDomain *domain, gpointer func, gpointer arg);
55 extern MonoThread *mono_thread_attach (MonoDomain *domain);
56 extern void mono_thread_detach (MonoThread *thread);
57 extern void mono_thread_exit (void);
59 void mono_threads_install_cleanup (MonoThreadCleanupFunc func);
61 extern void mono_threads_set_default_stacksize (guint32 stacksize);
62 extern guint32 mono_threads_get_default_stacksize (void);
63 guint32 mono_alloc_special_static_data (guint32 static_type, guint32 size, guint32 align);
64 gpointer mono_get_special_static_data (guint32 offset);
66 void mono_gc_stop_world (void);
68 void mono_gc_start_world (void);
70 extern MonoException* mono_thread_request_interruption (gboolean running_managed);
71 extern gboolean mono_thread_interruption_requested (void);
72 extern void mono_thread_interruption_checkpoint (void);
73 extern void mono_thread_force_interruption_checkpoint (void);
74 extern gint32* mono_thread_interruption_request_flag (void);
76 #endif /* _MONO_METADATA_THREADS_H_ */