2 * threads.h: Threading API
5 * Dick Porter (dick@ximian.com)
6 * Patrik Torstensson (patrik.torstensson@labs2.com)
11 #ifndef _MONO_METADATA_THREADS_H_
12 #define _MONO_METADATA_THREADS_H_
14 #include <mono/utils/mono-membar.h>
15 #include <mono/metadata/object.h>
16 #include <mono/metadata/appdomain.h>
20 typedef void (*MonoThreadCleanupFunc
) (MonoThread
* thread
);
22 /* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */
23 typedef gboolean (*MonoThreadManageCallback
) (MonoThread
* thread
);
25 extern int mono_thread_get_abort_signal (void);
27 extern void mono_thread_init (MonoThreadStartCB start_cb
,
28 MonoThreadAttachCB attach_cb
);
29 extern void mono_thread_cleanup (void);
30 extern void mono_thread_manage(void);
31 extern void mono_thread_abort_all_other_threads (void);
32 extern void mono_thread_suspend_all_other_threads (void);
34 extern void mono_thread_push_appdomain_ref (MonoDomain
*domain
);
35 extern void mono_thread_pop_appdomain_ref (void);
36 extern gboolean
mono_thread_has_appdomain_ref (MonoThread
*thread
, MonoDomain
*domain
);
38 extern gboolean
mono_threads_abort_appdomain_threads (MonoDomain
*domain
, int timeout
);
39 extern void mono_threads_clear_cached_culture (MonoDomain
*domain
);
41 extern MonoThread
*mono_thread_current (void);
43 extern void mono_thread_set_main (MonoThread
*thread
);
44 extern MonoThread
*mono_thread_get_main (void);
46 extern void mono_thread_stop (MonoThread
*thread
);
48 extern void mono_thread_new_init (gsize tid
, gpointer stack_start
,
50 extern void mono_thread_create (MonoDomain
*domain
, gpointer func
, gpointer arg
);
51 extern MonoThread
*mono_thread_attach (MonoDomain
*domain
);
52 extern void mono_thread_detach (MonoThread
*thread
);
53 extern void mono_thread_exit (void);
55 void mono_threads_install_cleanup (MonoThreadCleanupFunc func
);
56 void mono_thread_set_manage_callback (MonoThread
*thread
, MonoThreadManageCallback func
);
58 extern void mono_threads_set_default_stacksize (guint32 stacksize
);
59 extern guint32
mono_threads_get_default_stacksize (void);
60 guint32
mono_alloc_special_static_data (guint32 static_type
, guint32 size
, guint32 align
);
61 gpointer
mono_get_special_static_data (guint32 offset
);
63 void mono_threads_request_thread_dump (void);
65 extern MonoException
* mono_thread_request_interruption (gboolean running_managed
);
66 extern gboolean
mono_thread_interruption_requested (void);
67 extern void mono_thread_interruption_checkpoint (void);
68 extern void mono_thread_force_interruption_checkpoint (void);
69 extern gint32
* mono_thread_interruption_request_flag (void);
73 #endif /* _MONO_METADATA_THREADS_H_ */