@@ -77,6 +77,7 @@ int main(int argc, char *argv[])
count++;
counter->cacheline1 = count;
count++;
+ __sync_synchronize();
}
break;
case UNSHARE:
@@ -86,6 +87,7 @@ int main(int argc, char *argv[])
count++;
counter->cacheline2 = count;
count++;
+ __sync_synchronize();
}
break;
case LOCKSHARE:
@@ -98,6 +100,7 @@ int main(int argc, char *argv[])
break;
case LOCKUNSHARE:
while (count < MAX_BOUNCES) {
+ __sync_synchronize();
/* Spin waiting for other side to change it. */
while (counter->cacheline1 != count);
__sync_val_compare_and_swap(&counter->cacheline2, count, count+1);
@@ -115,6 +118,7 @@ int main(int argc, char *argv[])
count++;
counter->cacheline1 = count;
count++;
+ __sync_synchronize();
}
break;
case UNSHARE:
@@ -124,6 +128,7 @@ int main(int argc, char *argv[])
count++;
counter->cacheline1 = count;
count++;
+ __sync_synchronize();
}
break;
case LOCKSHARE: