* src/threads/native/lock.c: Implemented Sable extension to tasuki lock.
[cacao.git] / src / threads / threads-common.h
index 7e388ed3fa10bf6e8a01db8751e28b3ae81f06ed..f744afbbd2a1e641291ac17638a012c3a5b8886b 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "vm/global.h"
 
-#include "native/jni.h"
+#include "native/llni.h"
 
 #if defined(ENABLE_THREADS)
 # include "threads/native/threads.h"
 #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
 
 
+/* inline functions ***********************************************************/
+
+/* threads_thread_get_object ***************************************************
+
+   Return the java.lang.Thread object for the given thread.
+
+*******************************************************************************/
+
+static inline java_handle_t *threads_thread_get_object(threadobject *t)
+{
+       return LLNI_WRAP(t->object);
+}
+
+
+/* threads_thread_set_object ***************************************************
+
+   Set the java.lang.Thread object for the given thread.
+
+*******************************************************************************/
+
+static inline void threads_thread_set_object(threadobject *t, java_handle_t *object)
+{
+       t->object = LLNI_DIRECT(object);
+}
+
+
 /* function prototypes ********************************************************/
 
 void          threads_preinit(void);
@@ -109,6 +151,11 @@ void          threads_impl_preinit(void);
 void          threads_list_lock(void);
 void          threads_list_unlock(void);
 
+#if defined(ENABLE_GC_CACAO)
+void          threads_mutex_gc_lock(void);
+void          threads_mutex_gc_unlock(void);
+#endif
+
 void          threads_mutex_join_lock(void);
 void          threads_mutex_join_unlock(void);