}
if (state.THREAD) {
outclassdefs.println(" pthread_t tid;");
- outclassdefs.println(" volatile int lockcount;");
outclassdefs.println(" volatile int notifycount;");
}
if(state.MGC) {
}
if (state.THREAD) {
classdefout.println(" pthread_t tid;");
- classdefout.println(" volatile int lockcount;");
classdefout.println(" volatile int notifycount;");
}
if (state.MGC) {
} 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;
}
}
BARRIER();
VAR(___this___)->tid=0;
BARRIER();
- VAR(___this___)->lockcount=0;
while(notifycount==VAR(___this___)->notifycount) {
#ifdef PRECISE_GC
}
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;
}
struct lockpair *lpair=&lptr->locks[--lptr->index];
if (lpair->islastlock) {
- lpair->object->tid=0;
MBARRIER();
- lpair->object->lockcount=0;
+ lpair->object->tid=0;
}
}
#endif