Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads-common.h 7984 2007-05-30 20:30:00Z twisti $
-
*/
/* 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 **********************************************************/
#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);
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);
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);
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 */