* src/threads/posix/thread-posix.cpp: Eliminated some easy-to-fix or pointless compil...
[cacao.git] / src / threads / posix / thread-posix.hpp
index 8f0e55c71ad5fac2115d5143259408dfe0a8b1e1..e24f6cc2ee8fee6c75b1f7c1e6f61fb8a981211e 100644 (file)
 #define THREAD_FLAG_DAEMON      0x04    /* daemon thread                      */
 #define THREAD_FLAG_IN_NATIVE   0x08    /* currently executing native code    */
 
-#define SUSPEND_REASON_JNI       1      /* suspended from JNI                 */
-#define SUSPEND_REASON_STOPWORLD 2      /* suspended from stop-thw-world      */
+#define SUSPEND_REASON_NONE      0      /* no reason to suspend               */
+#define SUSPEND_REASON_JAVA      1      /* suspended from java.lang.Thread    */
+#define SUSPEND_REASON_STOPWORLD 2      /* suspended from stop-the-world      */
+#define SUSPEND_REASON_DUMP      3      /* suspended from threadlist dumping  */
+#define SUSPEND_REASON_JVMTI     4      /* suspended from JVMTI agent         */
 
 
 typedef struct threadobject threadobject;
@@ -211,19 +214,6 @@ inline static threadobject* thread_get_current(void);
 #include "vm/jit/intrp/intrp.h"
 #endif
 
-#if defined(__DARWIN__)
-# include <mach/mach.h>
-
-typedef struct {
-       Mutex* mutex;
-       Condition* cond;
-       int value;
-} sem_t;
-
-#else
-# include <semaphore.h>
-#endif
-
 
 // FIXME
 #ifdef __cplusplus
@@ -266,7 +256,8 @@ inline static void thread_set_current(threadobject* t)
        result = pthread_setspecific(thread_current_key, t);
 
        if (result != 0)
-               vm_abort_errnum(result, "thread_set_current: pthread_setspecific failed");
+               //os::abort_errnum(result, "thread_set_current: pthread_setspecific failed");
+               vm_abort("thread_set_current: pthread_setspecific failed");
 #endif
 }
 
@@ -284,19 +275,13 @@ inline static void threads_set_current_stackframeinfo(struct stackframeinfo_t* s
 
 /* functions ******************************************************************/
 
-void threads_sem_init(sem_t *sem, bool shared, int value);
-void threads_sem_wait(sem_t *sem);
-void threads_sem_post(sem_t *sem);
-
 void threads_start_thread(threadobject *thread, functionptr function);
 
 void threads_set_thread_priority(pthread_t tid, int priority);
 
-#if defined(ENABLE_GC_CACAO)
-bool threads_suspend_thread(threadobject *thread, s4 reason);
-void threads_suspend_ack(u1* pc, u1* sp);
-bool threads_resume_thread(threadobject *thread);
-#endif
+bool threads_suspend_thread(threadobject *thread, int32_t reason);
+bool threads_resume_thread(threadobject *thread, int32_t reason);
+void threads_suspend_ack();
 
 void threads_join_all_threads(void);