changes.
[IRC.git] / Robust / src / Runtime / thread.h
index e5388ab5985e313b1f1ff9259d137c9144df298f..773325d17b60cc91b3885bcda153bcff348d69de 100644 (file)
@@ -2,6 +2,7 @@
 #define THREAD_H
 #include "methodheaders.h"
 #include <pthread.h>
+#include "objtypes.h"
 
 extern int threadcount;
 extern pthread_mutex_t gclock;
@@ -10,18 +11,33 @@ extern pthread_cond_t gccond;
 extern pthread_mutex_t objlock;
 extern pthread_cond_t objcond;
 extern pthread_key_t threadlocks;
-#ifdef THREADS
-void initthread(struct ___Thread___ * ___this___);
+extern pthread_mutex_t atomiclock;
+#ifdef MAC
+extern pthread_key_t litemkey;
+extern pthread_key_t macthreadid;
+extern pthread_key_t memorybasekey;
+extern pthread_key_t memorytopkey;
+#endif
+
+#ifdef PRECISE_GC
+#define ATOMICLOCK if (pthread_mutex_trylock(&atomiclock)!=0) { \
+    stopforgc((struct garbagelist *) &___locals___);            \
+    pthread_mutex_lock(&atomiclock);                            \
+    restartaftergc();                                           \
+}
+
+#define ATOMICUNLOCK pthread_mutex_unlock(&atomiclock)
+#else
+#define ATOMICLOCK pthread_mutex_lock(&atomiclock)
+#define ATOMICUNLOCK pthread_mutex_unlock(&atomiclock)
+#endif
+
+#if defined(THREADS)||defined(STM)
+void initthread(ThreadPtr ___this___);
 #endif
 #ifdef DSTM
 void initDSMthread(int *ptr);
 void startDSMthread(int oid, int objType);
 extern void * virtualtable[];
 #endif
-
-struct locklist {
-  struct locklist * next;
-  struct locklist * prev;
-  struct ___Object___ * object;
-};
 #endif