Index: libcfa/src/concurrency/actor.hfa
===================================================================
--- libcfa/src/concurrency/actor.hfa	(revision 24d6572fc571b2a894d56a9335edd57899c448c0)
+++ libcfa/src/concurrency/actor.hfa	(revision 62d62db217dc9f917346863faa9d03148d98844f)
@@ -13,4 +13,6 @@
 #endif // CFA_DEBUG
 
+#define DEBUG_ABORT( cond, string ) CFA_DEBUG( if ( cond ) abort( string ) )
+
 // Define the default number of processors created in the executor. Must be greater than 0.
 #define __DEFAULT_EXECUTOR_PROCESSORS__ 2
@@ -42,7 +44,7 @@
 struct executor;
 
-enum Allocation { Nodelete, Delete, Destroy, Finished }; // allocation status
-
-typedef Allocation (*__receive_fn)(actor &, message &);
+enum allocation { Nodelete, Delete, Destroy, Finished }; // allocation status
+
+typedef allocation (*__receive_fn)(actor &, message &);
 struct request {
     actor * receiver;
@@ -393,5 +395,5 @@
 struct actor {
     size_t ticket;	                                    // executor-queue handle
-    Allocation allocation_;			                    // allocation action
+    allocation allocation_;			                    // allocation action
     inline virtual_dtor;
 };
@@ -400,5 +402,5 @@
     // Once an actor is allocated it must be sent a message or the actor system cannot stop. Hence, its receive
     // member must be called to end it
-    verifyf( __actor_executor_, "Creating actor before calling start_actor_system() can cause undefined behaviour.\n" ); 
+    DEBUG_ABORT( __actor_executor_ == 0p, "Creating actor before calling start_actor_system() can cause undefined behaviour.\n" );
     allocation_ = Nodelete;
     ticket = __get_next_ticket( *__actor_executor_ );
@@ -430,5 +432,5 @@
 
 struct message {
-    Allocation allocation_;			// allocation action
+    allocation allocation_;			// allocation action
     inline virtual_dtor;
 };
@@ -437,7 +439,7 @@
     this.allocation_ = Nodelete;
 }
-static inline void ?{}( message & this, Allocation allocation ) {
-    memcpy( &this.allocation_, &allocation, sizeof(allocation) ); // optimization to elide ctor
-    verifyf( this.allocation_ != Finished, "The Finished Allocation status is not supported for message types.\n");
+static inline void ?{}( message & this, allocation alloc ) {
+    memcpy( &this.allocation_, &alloc, sizeof(allocation) ); // optimization to elide ctor
+    DEBUG_ABORT( this.allocation_ == Finished, "The Finished allocation status is not supported for message types.\n" );
 }
 static inline void ^?{}( message & this ) with(this) {
@@ -453,9 +455,10 @@
     } // switch
 }
-static inline void set_allocation( message & this, Allocation state ) {
+static inline void set_allocation( message & this, allocation state ) {
     this.allocation_ = state;
 }
 
 static inline void deliver_request( request & this ) {
+    DEBUG_ABORT( this.receiver->ticket == (unsigned long int)MAX, "Attempted to send message to deleted/dead actor\n" );
     this.receiver->allocation_ = this.fn( *this.receiver, *this.msg );
     check_message( *this.msg );
@@ -631,5 +634,5 @@
 
 static inline void send( actor & this, request & req ) {
-    verifyf( this.ticket != (unsigned long int)MAX, "Attempted to send message to deleted/dead actor\n" );
+    DEBUG_ABORT( this.ticket == (unsigned long int)MAX, "Attempted to send message to deleted/dead actor\n" );
     send( *__actor_executor_, req, this.ticket );
 }
@@ -680,10 +683,10 @@
 // assigned at creation to __base_msg_finished to avoid unused message warning
 message __base_msg_finished @= { .allocation_ : Finished };
-struct __DeleteMsg { inline message; } DeleteMsg = __base_msg_finished;
-struct __DestroyMsg { inline message; } DestroyMsg = __base_msg_finished;
-struct __FinishedMsg { inline message; } FinishedMsg = __base_msg_finished;
-
-Allocation receive( actor & this, __DeleteMsg & msg ) { return Delete; }
-Allocation receive( actor & this, __DestroyMsg & msg ) { return Destroy; }
-Allocation receive( actor & this, __FinishedMsg & msg ) { return Finished; }
-
+struct __delete_msg_t { inline message; } delete_msg = __base_msg_finished;
+struct __destroy_msg_t { inline message; } destroy_msg = __base_msg_finished;
+struct __finished_msg_t { inline message; } finished_msg = __base_msg_finished;
+
+allocation receive( actor & this, __delete_msg_t & msg ) { return Delete; }
+allocation receive( actor & this, __destroy_msg_t & msg ) { return Destroy; }
+allocation receive( actor & this, __finished_msg_t & msg ) { return Finished; }
+
Index: libcfa/src/concurrency/atomic.hfa
===================================================================
--- libcfa/src/concurrency/atomic.hfa	(revision 24d6572fc571b2a894d56a9335edd57899c448c0)
+++ libcfa/src/concurrency/atomic.hfa	(revision 62d62db217dc9f917346863faa9d03148d98844f)
@@ -10,22 +10,42 @@
 // Created On       : Thu May 25 15:22:46 2023
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May 25 15:24:45 2023
-// Update Count     : 1
+// Last Modified On : Fri Jun  9 13:36:47 2023
+// Update Count     : 46
 // 
 
-#define LOAD( lock ) (__atomic_load_n( &(lock), __ATOMIC_SEQ_CST ))
-#define LOADM( lock, memorder ) (__atomic_load_n( &(lock), memorder ))
-#define STORE( lock, assn ) (__atomic_store_n( &(lock), assn, __ATOMIC_SEQ_CST ))
-#define STOREM( lock, assn, memorder ) (__atomic_store_n( &(lock), assn, memorder ))
-#define CLR( lock ) (__atomic_clear( &(lock), __ATOMIC_RELEASE ))
-#define CLRM( lock, memorder ) (__atomic_clear( &(lock), memorder ))
-#define TAS( lock ) (__atomic_test_and_set( &(lock), __ATOMIC_ACQUIRE ))
-#define TASM( lock, memorder ) (__atomic_test_and_set( &(lock), memorder ))
-#define CAS( change, comp, assn ) ({typeof(comp) __temp = (comp); __atomic_compare_exchange_n( &(change), &(__temp), (assn), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ); })
-#define CASM( change, comp, assn, memorder... ) ({typeof(comp) * __temp = &(comp); __atomic_compare_exchange_n( &(change), &(__temp), (assn), false, memorder, memorder ); })
-#define CASV( change, comp, assn ) (__atomic_compare_exchange_n( &(change), &(comp), (assn), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ))
-#define CASVM( change, comp, assn, memorder... ) (__atomic_compare_exchange_n( &(change), &(comp), (assn), false, memorder, memorder ))
-#define FAS( change, assn ) (__atomic_exchange_n( &(change), (assn), __ATOMIC_SEQ_CST ))
-#define FASM( change, assn, memorder ) (__atomic_exchange_n( &(change), (assn), memorder ))
-#define FAI( change, Inc ) (__atomic_fetch_add( &(change), (Inc), __ATOMIC_SEQ_CST ))
-#define FAIM( change, Inc, memorder ) (__atomic_fetch_add( &(change), (Inc), memorder ))
+#define LOAD( val ) (LOADM( val, __ATOMIC_SEQ_CST))
+#define LOADM( val, memorder ) (__atomic_load_n( &(val), memorder))
+
+#define STORE( val, assn ) (STOREM( val, assn, __ATOMIC_SEQ_CST))
+#define STOREM( val, assn, memorder ) (__atomic_store_n( &(val), assn, memorder))
+
+#define TAS( lock ) (TASM( lock, __ATOMIC_ACQUIRE))
+#define TASM( lock, memorder ) (__atomic_test_and_set( &(lock), memorder))
+
+#define TASCLR( lock ) (TASCLRM( lock, __ATOMIC_RELEASE))
+#define TASCLRM( lock, memorder ) (__atomic_clear( &(lock), memorder))
+
+#define FAS( assn, replace ) (FASM(assn, replace, __ATOMIC_SEQ_CST))
+#define FASM( assn, replace, memorder ) (__atomic_exchange_n( &(assn), (replace), memorder))
+
+#define FAI( assn, Inc ) (__atomic_fetch_add( &(assn), (Inc), __ATOMIC_SEQ_CST))
+#define FAIM( assn, Inc, memorder ) (__atomic_fetch_add( &(assn), (Inc), memorder))
+
+// Use __sync because __atomic with 128-bit CAA can result in calls to pthread_mutex_lock.
+
+// #define CAS( assn, comp, replace ) (CASM( assn, comp, replace, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+// #define CASM( assn, comp, replace, memorder... ) ({ \
+//  	typeof(comp) __temp = (comp); \
+//  	__atomic_compare_exchange_n( &(assn), &(__temp), (replace), false, memorder ); \
+// })
+#define CAS( assn, comp, replace ) (__sync_bool_compare_and_swap( &assn, comp, replace))
+#define CASM( assn, comp, replace, memorder... ) _Static_assert( false, "memory order unsupported for CAS macro" );
+
+// #define CASV( assn, comp, replace ) (__atomic_compare_exchange_n( &(assn), &(comp), (replace), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ))
+// #define CASVM( assn, comp, replace, memorder... ) (__atomic_compare_exchange_n( &(assn), &(comp), (replace), false, memorder, memorder ))
+#define CASV( assn, comp, replace ) ({ \
+	typeof(comp) temp = comp; \
+	typeof(comp) old = __sync_val_compare_and_swap( &(assn), (comp), (replace) ); \
+	old == temp ? true : (comp = old, false); \
+})
+#define CASVM( assn, comp, replace, memorder... ) _Static_assert( false, "memory order unsupported for CASV macro" );
Index: libcfa/src/concurrency/channel.hfa
===================================================================
--- libcfa/src/concurrency/channel.hfa	(revision 24d6572fc571b2a894d56a9335edd57899c448c0)
+++ libcfa/src/concurrency/channel.hfa	(revision 62d62db217dc9f917346863faa9d03148d98844f)
@@ -51,6 +51,6 @@
 vtable(channel_closed) channel_closed_vt;
 
-static inline bool is_insert( channel_closed & e ) { return elem != 0p; }
-static inline bool is_remove( channel_closed & e ) { return elem == 0p; }
+static inline bool is_insert( channel_closed & e ) { return e.elem != 0p; }
+static inline bool is_remove( channel_closed & e ) { return e.elem == 0p; }
 
 // #define CHAN_STATS // define this to get channel stats printed in dtor
Index: libcfa/src/concurrency/locks.hfa
===================================================================
--- libcfa/src/concurrency/locks.hfa	(revision 24d6572fc571b2a894d56a9335edd57899c448c0)
+++ libcfa/src/concurrency/locks.hfa	(revision 62d62db217dc9f917346863faa9d03148d98844f)
@@ -32,6 +32,4 @@
 #include "select.hfa"
 
-#include <fstream.hfa>
-
 // futex headers
 #include <linux/futex.h>      /* Definition of FUTEX_* constants */
