2010-05-14 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git] / mono / metadata / threads.h
blobcd084ae50ce8e517ab39b61f586e3fc2d356c507
1 /*
2 * threads.h: Threading API
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/utils/mono-publib.h>
15 #include <mono/metadata/object.h>
16 #include <mono/metadata/appdomain.h>
18 MONO_BEGIN_DECLS
20 typedef void (*MonoThreadCleanupFunc) (MonoThread* thread);
22 /* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */
23 typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread);
25 extern void mono_thread_init (MonoThreadStartCB start_cb,
26 MonoThreadAttachCB attach_cb);
27 extern void mono_thread_cleanup (void);
28 extern void mono_thread_manage(void);
30 extern MonoThread *mono_thread_current (void);
32 extern void mono_thread_set_main (MonoThread *thread);
33 extern MonoThread *mono_thread_get_main (void);
35 extern void mono_thread_stop (MonoThread *thread);
37 extern void mono_thread_new_init (intptr_t tid, void* stack_start,
38 void* func);
39 extern void mono_thread_create (MonoDomain *domain, void* func, void* arg);
40 extern MonoThread *mono_thread_attach (MonoDomain *domain);
41 extern void mono_thread_detach (MonoThread *thread);
42 extern void mono_thread_exit (void);
44 void mono_threads_install_cleanup (MonoThreadCleanupFunc func);
45 void mono_thread_set_manage_callback (MonoThread *thread, MonoThreadManageCallback func);
47 extern void mono_threads_set_default_stacksize (uint32_t stacksize);
48 extern uint32_t mono_threads_get_default_stacksize (void);
50 void mono_threads_request_thread_dump (void);
52 MONO_END_DECLS
54 #endif /* _MONO_METADATA_THREADS_H_ */