* src/vm/jit/s390/codegen.h (N_BRANCH_MIN, N_BRANCH_MAX): Fix (muliply by 2).
[cacao.git] / src / threads / threads-common.h
index a440f12d54891e3e3189fbee693ee3178368154f..d1412c786eeeceea2755e4541d430d6bd700b4d6 100644 (file)
@@ -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 $
-
 */
 
 
 
 /* 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);
@@ -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 */