Merged with tip.
[cacao.git] / src / threads / posix / thread-posix.h
index ac6f176d82365fa85f9e4ce6b0d6407211e04811..bb8b4206d9efdf30553678d0d6785b34d0e58e1e 100644 (file)
@@ -40,9 +40,14 @@ typedef struct threadobject threadobject;
 
 #include "mm/memory.h"
 
+#if defined(ENABLE_TLH)
+#include "mm/tlh.h"
+#endif
+
 #include "native/localref.h"
 
-#include "threads/mutex.h"
+#include "threads/condition.hpp"
+#include "threads/mutex.hpp"
 
 #include "threads/posix/lock.h"
 
@@ -73,18 +78,17 @@ typedef struct {
 #endif
 
 
+
 /* current threadobject *******************************************************/
 
 #if defined(HAVE___THREAD)
 
-#define THREADSPECIFIC    __thread
 #define THREADOBJECT      thread_current
 
 extern __thread threadobject *thread_current;
 
 #else /* defined(HAVE___THREAD) */
 
-#define THREADSPECIFIC
 #define THREADOBJECT \
        ((threadobject *) pthread_getspecific(thread_current_key))
 
@@ -128,19 +132,18 @@ struct threadobject {
        struct threadobject  *flc_list;     /* FLC list head for this thread      */
        struct threadobject  *flc_next;     /* next pointer for FLC list          */
        java_handle_t        *flc_object;
-       mutex_t               flc_lock;     /* controlling access to these fields */
-       pthread_cond_t        flc_cond;
+       Mutex*                flc_lock;     /* controlling access to these fields */
+       Condition*            flc_cond;
 
        /* these are used for the wait/notify implementation                      */
-       mutex_t               waitmutex;
-       pthread_cond_t        waitcond;
+       Mutex*                waitmutex;
+       Condition*            waitcond;
 
-       mutex_t               suspendmutex; /* lock before suspending this thread */
-       pthread_cond_t        suspendcond;  /* notify to resume this thread       */
+       Mutex*                suspendmutex; /* lock before suspending this thread */
+       Condition*            suspendcond;  /* notify to resume this thread       */
 
        bool                  interrupted;
        bool                  signaled;
-       bool                  sleeping;
 
        bool                  suspended;    /* is this thread suspended?          */
        s4                    suspend_reason; /* reason for suspending            */
@@ -173,6 +176,14 @@ struct threadobject {
        u4                    tracejavacallcount;
 #endif
 
+#if defined(ENABLE_TLH)
+       tlh_t                 tlh;
+#endif
+
+#if defined(ENABLE_ESCAPE_REASON)
+       void *escape_reasons;
+#endif
+
        listnode_t            linkage;      /* threads-list                       */
        listnode_t            linkage_free; /* free-list                          */
 };
@@ -273,8 +284,6 @@ void threads_start_thread(threadobject *thread, functionptr function);
 
 void threads_set_thread_priority(pthread_t tid, int priority);
 
-bool threads_detach_thread(threadobject *thread);
-
 #if defined(ENABLE_GC_CACAO)
 bool threads_suspend_thread(threadobject *thread, s4 reason);
 void threads_suspend_ack(u1* pc, u1* sp);
@@ -289,6 +298,11 @@ void threads_wait_with_timeout_relative(threadobject *t, s8 millis, s4 nanos);
 
 void threads_thread_interrupt(threadobject *thread);
 
+#if defined(ENABLE_TLH)
+void threads_tlh_add_frame();
+void threads_tlh_remove_frame();
+#endif
+
 #endif /* _THREAD_POSIX_H */