Index: libcfa/src/concurrency/io.cfa
===================================================================
--- libcfa/src/concurrency/io.cfa	(revision 1a567d0b9a1631f52b82268eb951631dcccf030a)
+++ libcfa/src/concurrency/io.cfa	(revision 3caf5e37ee553cf8f3b0cae6d46bb65b3d8293fa)
@@ -99,14 +99,15 @@
 		/* paranoid */ verify( ctx );
 
+		const __u32 mask = *ctx->cq.mask;
+
+
+		{
+			const __u32 head = *ctx->cq.head;
+			const __u32 tail = *ctx->cq.tail;
+
+			if(head == tail) return false;
+		}
+
 		// Drain the queue
-		unsigned head = *ctx->cq.head;
-		unsigned tail = *ctx->cq.tail;
-		const __u32 mask = *ctx->cq.mask;
-
-		__u32 count = tail - head;
-		__STATS__( false, io.calls.drain++; io.calls.completed += count; )
-
-		if(count == 0) return false;
-
 		if(!__atomic_try_acquire(&ctx->cq.lock)) {
 			return false;
@@ -114,4 +115,10 @@
 
 		unsigned long long ts_prev = ctx->cq.ts;
+
+		// re-read the head and tail in case it already changed.
+		const __u32 head = *ctx->cq.head;
+		const __u32 tail = *ctx->cq.tail;
+		const __u32 count = tail - head;
+		__STATS__( false, io.calls.drain++; io.calls.completed += count; )
 
 		for(i; count) {
