changes
[IRC.git] / Robust / src / Runtime / object.c
index d0f59488dc834eddf563a31a490f6bc6f1ea9624..d9b775b49fa56d053efd726ebed4d193e6f279bf 100644 (file)
 #endif
 
 #ifndef MAC
+#ifdef THREADS
 __thread struct lockvector lvector;
 __thread int mythreadid;
+#endif
 #else
 
 #endif
@@ -35,6 +37,7 @@ int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
 #ifdef THREADS
 #ifdef D___Object______MonitorEnter____
 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
+#ifndef NOLOCK
 #ifdef MAC
   struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
   int self=(int)(long)pthread_getspecific(macthreadid);
@@ -51,18 +54,19 @@ void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
     lpair->islastlock=1;
     while(1) {
       if (VAR(___this___)->tid==0) {
-       if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
-         return;
-       }
+        if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
+          return;
+        }
       }
       {
 #ifdef PRECISE_GC
-       if (unlikely(needtocollect))
-         checkcollect((struct garbagelist *)___params___);
+        if (unlikely(needtocollect))
+          checkcollect((struct garbagelist *)___params___);
 #endif
       }
     }
   }
+#endif
 }
 #endif
 
@@ -90,7 +94,7 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
   BARRIER();
   VAR(___this___)->tid=0;
   BARRIER();
-  
+
   while(notifycount==VAR(___this___)->notifycount) {
 #ifdef PRECISE_GC
     if (unlikely(needtocollect))
@@ -101,8 +105,8 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
   while(1) {
     if (VAR(___this___)->tid==0) {
       if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
-       BARRIER();
-       return;
+        BARRIER();
+        return;
       }
     }
 #ifdef PRECISE_GC
@@ -115,17 +119,19 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
 
 #ifdef D___Object______MonitorExit____
 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
+#ifndef NOLOCK
 #ifdef MAC
   struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
 #else
   struct lockvector *lptr=&lvector;
 #endif
   struct lockpair *lpair=&lptr->locks[--lptr->index];
-  
+
   if (lpair->islastlock) {
     MBARRIER();
     lpair->object->tid=0;
   }
+#endif
 }
 #endif
 #endif