X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fthreads%2Fthreads-common.h;h=60fd1155833fc0e19bac467dc2c3287d4c8d4cca;hb=9f859ad50d3d5d98c185d40b86b2179bc4dc9aeb;hp=0afa115142871adf448acfcfb6a91a0824e6365b;hpb=58f161062c091942961e363ff13e657681a9a202;p=cacao.git diff --git a/src/threads/threads-common.h b/src/threads/threads-common.h index 0afa11514..60fd11558 100644 --- a/src/threads/threads-common.h +++ b/src/threads/threads-common.h @@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: signal.c 7246 2007-01-29 18:49:05Z twisti $ - */ @@ -33,6 +31,10 @@ #include "config.h" #include "vm/types.h" +#include "vm/global.h" + +#include "native/jni.h" + #if defined(ENABLE_THREADS) # include "threads/native/threads.h" #else @@ -42,6 +44,20 @@ #include "vmcore/utf8.h" +/* only define the following stuff with thread enabled ************************/ + +#if defined(ENABLE_THREADS) + +/* thread states **************************************************************/ + +#define THREAD_STATE_NEW 0 +#define THREAD_STATE_RUNNABLE 1 +#define THREAD_STATE_BLOCKED 2 +#define THREAD_STATE_WAITING 3 +#define THREAD_STATE_TIMED_WAITING 4 +#define THREAD_STATE_TERMINATED 5 + + /* thread priorities **********************************************************/ #define MIN_PRIORITY 1 @@ -49,12 +65,61 @@ #define MAX_PRIORITY 10 +#if defined(__LINUX__) +/* XXX Remove for exact-GC. */ +extern bool threads_pthreads_implementation_nptl; +#endif + + /* function prototypes ********************************************************/ -threadobject *threads_create_thread(utf *name); +void threads_preinit(void); + +threadobject *threads_list_first(void); +threadobject *threads_list_next(threadobject *t); +s4 threads_list_get_non_daemons(void); + +threadobject *threads_thread_new(void); +void threads_thread_free(threadobject *t); + +bool threads_thread_start_internal(utf *name, functionptr f); +void threads_thread_start(java_lang_Thread *object); + +void threads_thread_print_info(threadobject *t); + ptrint threads_get_current_tid(void); + +void threads_thread_state_runnable(threadobject *t); +void threads_thread_state_waiting(threadobject *t); +void threads_thread_state_timed_waiting(threadobject *t); +void threads_thread_state_terminated(threadobject *t); +utf *threads_thread_get_state(threadobject *t); + +bool threads_thread_is_alive(threadobject *thread); + void threads_dump(void); -void threads_print_stacktrace(threadobject *thread); +void threads_thread_print_stacktrace(threadobject *thread); +void threads_print_stacktrace(void); + + +/* implementation specific functions */ + +void threads_impl_preinit(void); + +void threads_list_lock(void); +void threads_list_unlock(void); + +void threads_mutex_join_lock(void); +void threads_mutex_join_unlock(void); + +void threads_set_current_threadobject(threadobject *thread); +void threads_impl_thread_new(threadobject *t); +void threads_impl_thread_free(threadobject *t); +void threads_impl_thread_start(threadobject *thread, functionptr f); + +void threads_yield(void); + +#endif /* ENABLE_THREADS */ #endif /* _THREADS_COMMON_H */