Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision b93bf851cd2f4c65993fbbd554e9a71949aa906d)
+++ libcfa/src/concurrency/kernel.cfa	(revision 99a7163b3869e330945506850a58bf021db4b32b)
@@ -10,6 +10,6 @@
 // Created On       : Tue Jan 17 12:27:26 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jan  9 08:42:05 2023
-// Update Count     : 77
+// Last Modified On : Fri Apr 25 07:02:42 2025
+// Update Count     : 82
 //
 
@@ -45,5 +45,5 @@
 #pragma GCC diagnostic pop
 
-#if !defined(__CFA_NO_STATISTICS__)
+#if ! defined(__CFA_NO_STATISTICS__)
 	#define __STATS_DEF( ...) __VA_ARGS__
 #else
@@ -158,6 +158,6 @@
 
 	__cfadbg_print_safe(runtime_core, "Kernel : core %p starting\n", this);
-	#if !defined(__CFA_NO_STATISTICS__)
-		if( this->print_halts ) {
+	#if ! defined(__CFA_NO_STATISTICS__)
+		if ( this->print_halts ) {
 			__cfaabi_bits_print_safe( STDOUT_FILENO, "Processor : %d - %s (%p)\n", this->unique_id, this->name, (void*)this);
 		}
@@ -169,5 +169,5 @@
 
 		// if we need to run some special setup, now is the time to do it.
-		if(this->init.thrd) {
+		if (this->init.thrd) {
 			this->init.thrd->curr_cluster = this->cltr;
 			__run_thread(this, this->init.thrd);
@@ -185,5 +185,5 @@
 			readyThread = __next_thread( this->cltr );
 
-			if( !readyThread ) {
+			if ( ! readyThread ) {
 				// there is no point in holding submissions if we are idle
 				__IO_STATS__(true, io.flush.idle++; )
@@ -196,8 +196,8 @@
 			}
 
-			if( !readyThread ) for(5) {
+			if ( ! readyThread ) for(5) {
 				readyThread = __next_thread_slow( this->cltr );
 
-				if( readyThread ) break;
+				if ( readyThread ) break;
 
 				// It's unlikely we still I/O to submit, but the arbiter could
@@ -210,14 +210,14 @@
 
 			HALT:
-			if( !readyThread ) {
+			if ( ! readyThread ) {
 				// Don't block if we are done
-				if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
+				if ( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
 
 				// Push self to idle stack
-				if(!mark_idle(this->cltr->procs, * this)) continue MAIN_LOOP;
+				if ( ! mark_idle(this->cltr->procs, * this)) continue MAIN_LOOP;
 
 				// Confirm the ready-queue is empty
 				readyThread = __next_thread_search( this->cltr );
-				if( readyThread ) {
+				if ( readyThread ) {
 					// A thread was found, cancel the halt
 					mark_awake(this->cltr->procs, * this);
@@ -247,7 +247,7 @@
 
 			// Are we done?
-			if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
-
-			if(__atomic_load_n(&this->io.pending, __ATOMIC_RELAXED) && !__atomic_load_n(&this->io.dirty, __ATOMIC_RELAXED)) {
+			if ( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
+
+			if (__atomic_load_n(&this->io.pending, __ATOMIC_RELAXED) && ! __atomic_load_n(&this->io.dirty, __ATOMIC_RELAXED)) {
 				__IO_STATS__(true, io.flush.dirty++; )
 				__cfa_io_flush( this );
@@ -263,5 +263,5 @@
 	post( this->terminated );
 
-	if(this == mainProcessor) {
+	if (this == mainProcessor) {
 		// HACK : the coroutine context switch expects this_thread to be set
 		// and it make sense for it to be set in all other cases except here
@@ -294,5 +294,6 @@
 
 	// Actually run the thread
-	RUNNING:  while(true) {
+	RUNNING:
+	while( true ) {
 		thrd_dst->preempted = __NO_PREEMPTION;
 
@@ -339,5 +340,5 @@
 		// In case 2, we lost the race so we now own the thread.
 
-		if(unlikely(thrd_dst->preempted != __NO_PREEMPTION)) {
+		if (unlikely(thrd_dst->preempted != __NO_PREEMPTION)) {
 			// Reset the this_thread now that we know
 			// the state isn't active anymore
@@ -349,5 +350,5 @@
 		}
 
-		if(unlikely(thrd_dst->state == Halting)) {
+		if (unlikely(thrd_dst->state == Halting)) {
 			// Reset the this_thread now that we know
 			// the state isn't active anymore
@@ -418,7 +419,7 @@
 	}
 
-	#if !defined(__CFA_NO_STATISTICS__)
+	#if ! defined(__CFA_NO_STATISTICS__)
 		/* paranoid */ verify( thrd_src->last_proc != 0p );
-		if(thrd_src->last_proc != kernelTLS().this_processor) {
+		if (thrd_src->last_proc != kernelTLS().this_processor) {
 			__tls_stats()->ready.threads.migration++;
 		}
@@ -440,7 +441,7 @@
 	/* paranoid */ verify( thrd->curr_cluster );
 	/* paranoid */ #if defined( __CFA_WITH_VERIFY__ )
-	/* paranoid */ 	if( thrd->state == Blocked || thrd->state == Start ) assertf( thrd->preempted == __NO_PREEMPTION,
+	/* paranoid */ 	if ( thrd->state == Blocked || thrd->state == Start ) assertf( thrd->preempted == __NO_PREEMPTION,
 					"Error inactive thread marked as preempted, state %d, preemption %d\n", thrd->state, thrd->preempted );
-	/* paranoid */ 	if( thrd->preempted != __NO_PREEMPTION ) assertf(thrd->state == Active,
+	/* paranoid */ 	if ( thrd->preempted != __NO_PREEMPTION ) assertf(thrd->state == Active,
 					"Error preempted thread marked as not currently running, state %d, preemption %d\n", thrd->state, thrd->preempted );
 	/* paranoid */ #endif
@@ -463,8 +464,8 @@
 	__wake_one( cl );
 
-	#if !defined(__CFA_NO_STATISTICS__)
-		if( kernelTLS().this_stats ) {
+	#if ! defined(__CFA_NO_STATISTICS__)
+		if ( kernelTLS().this_stats ) {
 			__tls_stats()->ready.threads.threads++;
-			if(outside) {
+			if (outside) {
 				__tls_stats()->ready.threads.extunpark++;
 			}
@@ -542,7 +543,7 @@
 	/* paranoid */ verify( ready_schedule_islocked());
 
-	if( !thrd ) return;
-
-	if(__must_unpark(thrd)) {
+	if ( ! thrd ) return;
+
+	if (__must_unpark(thrd)) {
 		// Wake lost the race,
 		__schedule_thread( thrd, hint );
@@ -554,7 +555,7 @@
 
 void unpark( thread$ * thrd, unpark_hint hint ) libcfa_public {
-	if( !thrd ) return;
-
-	if(__must_unpark(thrd)) {
+	if ( ! thrd ) return;
+
+	if (__must_unpark(thrd)) {
 		disable_interrupts();
 			// Wake lost the race,
@@ -592,7 +593,7 @@
 		/* paranoid */ verifyf( ((uintptr_t)thrd->context.SP) < ((uintptr_t)__get_stack(thrd->curr_cor)->base ), "ERROR : thread$ %p has been corrupted.\n StackPointer too small.\n", thrd );
 
-		if( TICKET_RUNNING != thrd->ticket ) { abort( "Thread terminated with pending unpark" ); }
-		if( thrd != this->owner ) { abort( "Thread internal monitor has incorrect owner" ); }
-		if( this->recursion != 1) { abort( "Thread internal monitor has unbalanced recursion" ); }
+		if ( TICKET_RUNNING != thrd->ticket ) { abort( "Thread terminated with pending unpark" ); }
+		if ( thrd != this->owner ) { abort( "Thread internal monitor has incorrect owner" ); }
+		if ( this->recursion != 1) { abort( "Thread internal monitor has unbalanced recursion" ); }
 
 		thrd->state = Halting;
@@ -618,5 +619,5 @@
 		// If that is the case, abandon the preemption.
 		bool preempted = false;
-		if(thrd->rdy_link.next == 0p) {
+		if (thrd->rdy_link.next == 0p) {
 			preempted = true;
 			thrd->preempted = reason;
@@ -641,8 +642,8 @@
 
 	// If no one is sleeping: we are done
-	if( fdp == 0p ) return;
+	if ( fdp == 0p ) return;
 
 	int fd = 1;
-	if( __atomic_load_n(&fdp->sem, __ATOMIC_SEQ_CST) != 1 ) {
+	if ( __atomic_load_n(&fdp->sem, __ATOMIC_SEQ_CST) != 1 ) {
 		fd = __atomic_exchange_n(&fdp->sem, 1, __ATOMIC_RELAXED);
 	}
@@ -652,6 +653,6 @@
 	case 0:
 		// If the processor isn't ready to sleep then the exchange will already wake it up
-		#if !defined(__CFA_NO_STATISTICS__)
-			if( kernelTLS().this_stats ) { __tls_stats()->ready.sleep.early++;
+		#if ! defined(__CFA_NO_STATISTICS__)
+			if ( kernelTLS().this_stats ) { __tls_stats()->ready.sleep.early++;
 			} else { __atomic_fetch_add(&this->stats->ready.sleep.early, 1, __ATOMIC_RELAXED); }
 		#endif
@@ -659,6 +660,6 @@
 	case 1:
 		// If someone else already said they will wake them: we are done
-		#if !defined(__CFA_NO_STATISTICS__)
-			if( kernelTLS().this_stats ) { __tls_stats()->ready.sleep.seen++;
+		#if ! defined(__CFA_NO_STATISTICS__)
+			if ( kernelTLS().this_stats ) { __tls_stats()->ready.sleep.seen++;
 			} else { __atomic_fetch_add(&this->stats->ready.sleep.seen, 1, __ATOMIC_RELAXED); }
 		#endif
@@ -670,6 +671,6 @@
 		/* paranoid */ verifyf( ret == 0, "Expected return to be 0, was %d\n", ret );
 
-		#if !defined(__CFA_NO_STATISTICS__)
-			if( kernelTLS().this_stats ) { __tls_stats()->ready.sleep.wakes++;
+		#if ! defined(__CFA_NO_STATISTICS__)
+			if ( kernelTLS().this_stats ) { __tls_stats()->ready.sleep.wakes++;
 			} else { __atomic_fetch_add(&this->stats->ready.sleep.wakes, 1, __ATOMIC_RELAXED); }
 		#endif
@@ -710,8 +711,8 @@
 
 		// Someone already told us to wake-up! No time for a nap.
-		if(expected == 1) { return; }
+		if (expected == 1) { return; }
 
 		// Try to mark that we are going to sleep
-		if(__atomic_compare_exchange_n(&this->idle_wctx.sem, &expected, this->idle_wctx.evfd, false,  __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ) {
+		if (__atomic_compare_exchange_n(&this->idle_wctx.sem, &expected, this->idle_wctx.evfd, false,  __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ) {
 			// Every one agreed, taking a nap
 			break;
@@ -720,6 +721,6 @@
 
 
-	#if !defined(__CFA_NO_STATISTICS__)
-		if(this->print_halts) {
+	#if ! defined(__CFA_NO_STATISTICS__)
+		if (this->print_halts) {
 			__cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 0\n", this->unique_id, rdtscl());
 		}
@@ -731,5 +732,5 @@
 		eventfd_t val;
 		ssize_t ret = read( this->idle_wctx.evfd, &val, sizeof(val) );
-		if(ret < 0) {
+		if (ret < 0) {
 			switch((int)errno) {
 			case EAGAIN:
@@ -746,6 +747,6 @@
 	}
 
-	#if !defined(__CFA_NO_STATISTICS__)
-		if(this->print_halts) {
+	#if ! defined(__CFA_NO_STATISTICS__)
+		if (this->print_halts) {
 			__cfaabi_bits_print_safe( STDOUT_FILENO, "PH:%d - %lld 1\n", this->unique_id, rdtscl());
 		}
@@ -759,5 +760,5 @@
 
 	/* paranoid */ verify( ! __preemption_enabled() );
-	if(!try_lock( this )) return false;
+	if ( ! try_lock( this )) return false;
 		this.idle++;
 		/* paranoid */ verify( this.idle <= this.total );
@@ -784,5 +785,5 @@
 			// update the pointer to the head wait context
 			struct __fd_waitctx * wctx = 0;
-			if(!this.idles`isEmpty) wctx = &this.idles`first.idle_wctx;
+			if ( ! isEmpty( this.idles )) wctx = &first( this. idles ).idle_wctx;
 			__atomic_store_n(&this.fdw, wctx, __ATOMIC_SEQ_CST);
 		}
@@ -798,5 +799,5 @@
 	thread$ * thrd = __cfaabi_tls.this_thread;
 
-	if(thrd) {
+	if (thrd) {
 		int len = snprintf( abort_text, abort_text_size, "Error occurred while executing thread %.256s (%p)", thrd->self_cor.name, thrd );
 		__cfaabi_bits_write( STDERR_FILENO, abort_text, len );
@@ -847,5 +848,5 @@
 //-----------------------------------------------------------------------------
 // Statistics
-#if !defined(__CFA_NO_STATISTICS__)
+#if ! defined(__CFA_NO_STATISTICS__)
 	void print_halts( processor & this ) libcfa_public {
 		this.print_halts = true;
@@ -855,5 +856,5 @@
 		/* paranoid */ verify( cltr->stats );
 
-		processor * it = &list`first;
+		processor * it = &first( list );
 		for(unsigned i = 0; i < count; i++) {
 			/* paranoid */ verifyf( it, "Unexpected null iterator, at index %u of %u\n", i, count);
@@ -861,5 +862,5 @@
 			// __print_stats( it->local_data->this_stats, cltr->print_stats, "Processor", it->name, (void*)it );
 			__tally_stats( cltr->stats, it->local_data->this_stats );
-			it = &(*it)`next;
+			it = &next( *it );
 		}
 	}
