X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fthreads%2Fthreads-common.h;h=d1412c786eeeceea2755e4541d430d6bd700b4d6;hb=205e45d916f794d5da70ade80823838ea6ab81cf;hp=a440f12d54891e3e3189fbee693ee3178368154f;hpb=b17e34d6e0d6e412eac6234c6c4fb2400daac9a3;p=cacao.git diff --git a/src/threads/threads-common.h b/src/threads/threads-common.h index a440f12d5..d1412c786 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: threads-common.h 7984 2007-05-30 20:30:00Z twisti $ - */ @@ -52,12 +50,12 @@ /* thread states **************************************************************/ -#define THREAD_STATE_NEW 1 -#define THREAD_STATE_RUNNABLE 2 -#define THREAD_STATE_BLOCKED 3 -#define THREAD_STATE_WAITING 4 -#define THREAD_STATE_TIMED_WAITING 5 -#define THREAD_STATE_TERMINATED 6 +#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 **********************************************************/ @@ -67,6 +65,28 @@ #define MAX_PRIORITY 10 +/* debug **********************************************************************/ + +#if !defined(NDEBUG) +# define DEBUGTHREADS(message, thread) \ + do { \ + if (opt_DebugThreads) { \ + printf("[Thread %-16s: ", message); \ + threads_thread_print_info(thread); \ + printf("]\n"); \ + } \ + } while (0) +#else +# define DEBUGTHREADS(message, thread) +#endif + + +#if defined(__LINUX__) +/* XXX Remove for exact-GC. */ +extern bool threads_pthreads_implementation_nptl; +#endif + + /* function prototypes ********************************************************/ void threads_preinit(void); @@ -79,7 +99,7 @@ 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_start(java_handle_t *object); void threads_thread_print_info(threadobject *t); @@ -91,7 +111,7 @@ 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); +bool threads_thread_is_alive(threadobject *t); void threads_dump(void); void threads_thread_print_stacktrace(threadobject *thread); @@ -105,11 +125,16 @@ 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 */