Index: tests/concurrency/barrier/order.cfa
===================================================================
--- tests/concurrency/barrier/order.cfa	(revision 41882628bfa69f8a243e4ff726329c75f9ba655a)
+++ tests/concurrency/barrier/order.cfa	(revision 0cb34792deaeef8c8e2053b3b0c6d350f4dbad00)
@@ -5,16 +5,12 @@
 // file "LICENCE" distributed with Cforall.
 //
-// order.cfa -- validates barriers the return value of
-//                                 barrier block
+// order.cfa -- validates barrier return value from barrier block
 //
 // Author           : Thierry Delisle
 // Created On       : Fri Apr 01 11:39:09 2022
-// Last Modified By :
-// Last Modified On :
-// Update Count     :
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sun Nov 10 11:22:56 2024
+// Update Count     : 20
 //
-
-// Test validates barrier and block return value by checking
-// that no more than one thread gets the same return value
 
 #include <concurrency/barrier.hfa>
@@ -23,48 +19,35 @@
 #include <thread.hfa>
 
-const unsigned NUM_LAPS = 173;
-const unsigned NUM_THREADS = 11;
+enum { NUM_LAPS = 173, NUM_THREADS = 11 };
 
-// The barrier we are testing
 barrier bar = { NUM_THREADS };
 
-// The return values of the previous generation.
-volatile unsigned * generation;
+volatile unsigned generation = 0;						// count laps
+void last() {
+	generation += 1;									// last thread at barrier advances
+}
+volatile unsigned * generations;						// global array pointer
 
 thread Tester {};
 void main( Tester & this ) {
-	// Repeat a few times
-	for(l; NUM_LAPS) {
-		// Yield for chaos
-		yield( prng(this, 10) );
+	for ( l; NUM_LAPS ) {
+		yield( prng( this, 10 ) );						// yield for chaos
+		unsigned int order = block( bar, last );		// block at barrier
 
-		// Block and what order we arrived
-		unsigned ret = block(bar);
-
-		// Check what was the last generation of that last thread in this position
-		unsigned g = generation[ret];
-
-		// Is it what we expect?
-		if(g != l) {
-			// Complain that they are different
-			sout | "Gen" | l | ": Expeced generation at" | ret | "to be" | l | "was" | g;
-		}
-
-		// Mark the expected next generation
-		generation[ret] = l+1;
-	}
+		// For G == T, no thread should be able to advance generation until current generation finishes.
+		if ( generation - 1 != l || generations[order] != l ) {	// generation advanced in block
+			mutex( sout ) sout | "mismatched generation, expected" | l | "got" | generation;
+		} // if
+		generations[order] = l + 1;						// every thread advances their current order generation
+	} // for
 }
 
 int main() {
-	// Create the data ans zero it.
 	volatile unsigned gen_data[NUM_THREADS];
-	for(t; NUM_THREADS)
-		gen_data[t] = 0;
+	for( t; NUM_THREADS ) gen_data[t] = 0;
+	generations = gen_data;								// global points at local
 
-	generation = gen_data;
-
-	// Run the experiment
-	processor p[4];
-	{
+	processor p[4];										// parallelism
+	{													// run experiment
 		Tester testers[NUM_THREADS];
 	}
