good for a little more speedup...
authorbdemsky <bdemsky>
Mon, 11 Apr 2011 09:28:00 +0000 (09:28 +0000)
committerbdemsky <bdemsky>
Mon, 11 Apr 2011 09:28:00 +0000 (09:28 +0000)
Robust/src/Runtime/object.c

index 6cd8da7094e4bf912f08f8d89b2db32333a3a72e..091b1218aedcc72071bd6d792041351a64f762f0 100644 (file)
@@ -57,7 +57,7 @@ void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
     lpair->islastlock=1;
     while(1) {
       if (VAR(___this___)->lockcount==0) {
-       if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
+       if (LOCKXCHG32(&VAR(___this___)->lockcount, 1)==0) {
          VAR(___this___)->tid=self;
          return;
        }
@@ -104,7 +104,7 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
 
   while(1) {
     if (VAR(___this___)->lockcount==0) {
-      if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
+      if (LOCKXCHG32(&VAR(___this___)->lockcount, 1)==0) {
        VAR(___this___)->tid=self;
        BARRIER();
        return;