X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FRuntime%2Fobject.c;h=61159ecd898f6d42f6f8285e161e98219c23f29a;hb=842143364178f59293f4d57914657c3b0b442ead;hp=091b1218aedcc72071bd6d792041351a64f762f0;hpb=a458f6c3db672f74f68fb9521503103dfc72f1ab;p=IRC.git diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c index 091b1218..61159ecd 100644 --- a/Robust/src/Runtime/object.c +++ b/Robust/src/Runtime/object.c @@ -56,9 +56,8 @@ void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { } else { lpair->islastlock=1; while(1) { - if (VAR(___this___)->lockcount==0) { - if (LOCKXCHG32(&VAR(___this___)->lockcount, 1)==0) { - VAR(___this___)->tid=self; + if (VAR(___this___)->tid==0) { + if (CAS32(&VAR(___this___)->tid, 0, self)==0) { return; } } @@ -93,7 +92,6 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) { BARRIER(); VAR(___this___)->tid=0; BARRIER(); - VAR(___this___)->lockcount=0; while(notifycount==VAR(___this___)->notifycount) { #ifdef PRECISE_GC @@ -103,9 +101,8 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) { } while(1) { - if (VAR(___this___)->lockcount==0) { - if (LOCKXCHG32(&VAR(___this___)->lockcount, 1)==0) { - VAR(___this___)->tid=self; + if (VAR(___this___)->tid==0) { + if (CAS32(&VAR(___this___)->tid, 0, self)==0) { BARRIER(); return; } @@ -128,9 +125,8 @@ void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) { struct lockpair *lpair=&lptr->locks[--lptr->index]; if (lpair->islastlock) { - lpair->object->tid=0; MBARRIER(); - lpair->object->lockcount=0; + lpair->object->tid=0; } } #endif