Index: libcfa/src/concurrency/barrier.hfa
===================================================================
--- libcfa/src/concurrency/barrier.hfa	(revision 93b8cf40f1dc4e4c569490157bff2a08be7c1534)
+++ libcfa/src/concurrency/barrier.hfa	(revision 1417f6b2c2ab63559e88f40687ed5ac6ce0c8b94)
@@ -18,25 +18,39 @@
 #include <monitor.hfa>
 
+// Simple barrier based on a monitor
 monitor barrier {
-	int max;
-	int count;
+	// Number of threads blocking needed to unblock the barrier
+	// Unsigned should be enough, I don't expect use cases with 2^32 thread barriers.
+	unsigned width;
 
+	// Current count (counting backwards)
+	unsigned count;
+
+	// Barrier uses internal scheduling
 	condition c;
 };
 
-void ?{}( barrier & this, int max ) {
-	this.max = max;
-	this.count = max;
+// Constructor
+void ?{}( barrier & this, unsigned width ) {
+	this.width = width;
+	this.count = width; // Count backwards so initialize at width
 }
 
-static inline int block(barrier & mutex this ) {
-	this.count -= 1;
-	int arrival = this.count;
-	if(arrival != 0) {
+// block until the number of threads needed have blocked
+// returns an value indicating the reverse order the threads arrived in
+// i.e. last thread will return 0 (and not block)
+//      second last thread returns 1
+//      etc.
+static inline unsigned block(barrier & mutex this ) {
+	this.count -= 1; // prefix decrement so we the last is 0 and not 1
+	unsigned arrival = this.count; // Note arrival order
+	if(arrival == 0) {
+		// If arrived last unblock everyone and reset
+		signal_all(this.c);
+		this.count = this.width;
+	} else {
+		// Otherwise block
 		wait(this.c);
-	} else {
-		signal_all(this.c);
-		this.count = this.max;
 	}
-	return arrival;
+	return arrival; // return arrival order
 }
