6 * Dick Porter (dick@ximian.com)
7 * Patrik Torstensson (patrik.torstensson@labs2.com)
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>
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 MONO_RT_EXTERNAL_ONLY
28 void mono_thread_manage(void);
30 MONO_API MonoThread
*mono_thread_current (void);
32 MONO_API
void mono_thread_set_main (MonoThread
*thread
);
33 MONO_API MonoThread
*mono_thread_get_main (void);
35 MONO_API MONO_RT_EXTERNAL_ONLY
void mono_thread_stop (MonoThread
*thread
);
37 MONO_API
void mono_thread_new_init (intptr_t tid
, void* stack_start
,
40 MONO_API MONO_RT_EXTERNAL_ONLY
void
41 mono_thread_create (MonoDomain
*domain
, void* func
, void* arg
);
43 MONO_API MONO_RT_EXTERNAL_ONLY MonoThread
*
44 mono_thread_attach (MonoDomain
*domain
);
45 MONO_API MONO_RT_EXTERNAL_ONLY
void
46 mono_thread_detach (MonoThread
*thread
);
47 MONO_API
void mono_thread_exit (void);
49 MONO_API MONO_RT_EXTERNAL_ONLY
void
50 mono_threads_attach_tools_thread (void);
52 MONO_API
char *mono_thread_get_name_utf8 (MonoThread
*thread
);
53 MONO_API
int32_t mono_thread_get_managed_id (MonoThread
*thread
);
55 MONO_API
void mono_thread_set_manage_callback (MonoThread
*thread
, MonoThreadManageCallback func
);
57 MONO_API
void mono_threads_set_default_stacksize (uint32_t stacksize
);
58 MONO_API
uint32_t mono_threads_get_default_stacksize (void);
60 MONO_API
void mono_threads_request_thread_dump (void);
62 MONO_API mono_bool
mono_thread_is_foreign (MonoThread
*thread
);
64 MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
65 mono_thread_detach_if_exiting (void);
69 #endif /* _MONO_METADATA_THREADS_H_ */