Index: src/libcfa/concurrency/kernel.c
===================================================================
--- src/libcfa/concurrency/kernel.c	(revision bd4d011a92b605ad83657c777542b73e1fad403f)
+++ src/libcfa/concurrency/kernel.c	(revision 9d944b2a97f0468ab2208567dbc494494cf66a93)
@@ -15,7 +15,9 @@
 //
 
+#include "startup.h"
+
 //Start and stop routine for the kernel, declared first to make sure they run first
-void kernel_startup(void)  __attribute__((constructor(101)));
-void kernel_shutdown(void) __attribute__((destructor(101)));
+void kernel_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
+void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
 
 //Header
@@ -25,6 +27,9 @@
 #include <stddef.h>
 extern "C" {
+#include <stdio.h>
 #include <fenv.h>
 #include <sys/resource.h>
+#include <signal.h>
+#include <unistd.h>
 }
 
@@ -146,5 +151,5 @@
 
 	this->runner = runner;
-	LIB_DEBUG_PRINTF("Kernel : constructing processor context %p\n", runner);
+	LIB_DEBUG_PRINT_SAFE("Kernel : constructing processor context %p\n", runner);
 	runner{ this };
 }
@@ -152,5 +157,5 @@
 void ^?{}(processor * this) {
 	if( ! this->is_terminated ) {
-		LIB_DEBUG_PRINTF("Kernel : core %p signaling termination\n", this);
+		LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", this);
 		this->is_terminated = true;
 		wait( &this->terminated );
@@ -173,5 +178,5 @@
 void main(processorCtx_t * runner) {
 	processor * this = runner->proc;
-	LIB_DEBUG_PRINTF("Kernel : core %p starting\n", this);
+	LIB_DEBUG_PRINT_SAFE("Kernel : core %p starting\n", this);
 
 	thread_desc * readyThread = NULL;
@@ -195,7 +200,7 @@
 	}
 
-	LIB_DEBUG_PRINTF("Kernel : core %p unlocking thread\n", this);
+	LIB_DEBUG_PRINT_SAFE("Kernel : core %p unlocking thread\n", this);
 	signal( &this->terminated );
-	LIB_DEBUG_PRINTF("Kernel : core %p terminated\n", this);
+	LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this);
 }
 
@@ -255,5 +260,5 @@
 	processorCtx_t proc_cor_storage = { proc, &info };
 
-	LIB_DEBUG_PRINTF("Coroutine : created stack %p\n", proc_cor_storage.__cor.stack.base);
+	LIB_DEBUG_PRINT_SAFE("Coroutine : created stack %p\n", proc_cor_storage.__cor.stack.base);
 
 	//Set global state
@@ -262,5 +267,5 @@
 
 	//We now have a proper context from which to schedule threads
-	LIB_DEBUG_PRINTF("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);
+	LIB_DEBUG_PRINT_SAFE("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);
 
 	// SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't 
@@ -273,5 +278,5 @@
 
 	// Main routine of the core returned, the core is now fully terminated
-	LIB_DEBUG_PRINTF("Kernel : core %p main ended (%p)\n", proc, proc->runner);	
+	LIB_DEBUG_PRINT_SAFE("Kernel : core %p main ended (%p)\n", proc, proc->runner);	
 
 	return NULL;
@@ -279,5 +284,5 @@
 
 void start(processor * this) {
-	LIB_DEBUG_PRINTF("Kernel : Starting core %p\n", this);
+	LIB_DEBUG_PRINT_SAFE("Kernel : Starting core %p\n", this);
 	
 	// pthread_attr_t attributes;
@@ -288,5 +293,5 @@
 	// pthread_attr_destroy( &attributes );
 
-	LIB_DEBUG_PRINTF("Kernel : core %p started\n", this);	
+	LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this);	
 }
 
@@ -334,5 +339,5 @@
 // Kernel boot procedures
 void kernel_startup(void) {
-	LIB_DEBUG_PRINTF("Kernel : Starting\n");	
+	LIB_DEBUG_PRINT_SAFE("Kernel : Starting\n");	
 
 	// Start by initializing the main thread
@@ -369,9 +374,9 @@
 
 	// THE SYSTEM IS NOW COMPLETELY RUNNING
-	LIB_DEBUG_PRINTF("Kernel : Started\n--------------------------------------------------\n\n");
+	LIB_DEBUG_PRINT_SAFE("Kernel : Started\n--------------------------------------------------\n\n");
 }
 
 void kernel_shutdown(void) {
-	LIB_DEBUG_PRINTF("\n--------------------------------------------------\nKernel : Shutting down\n");
+	LIB_DEBUG_PRINT_SAFE("\n--------------------------------------------------\nKernel : Shutting down\n");
 
 	// SKULLDUGGERY: Notify the systemProcessor it needs to terminates.
@@ -392,5 +397,58 @@
 	^(mainThread){};
 
-	LIB_DEBUG_PRINTF("Kernel : Shutdown complete\n");	
+	LIB_DEBUG_PRINT_SAFE("Kernel : Shutdown complete\n");	
+}
+
+static spinlock kernel_abort_lock;
+static spinlock kernel_debug_lock;
+static bool kernel_abort_called = false;
+
+void * kernel_abort    (void) __attribute__ ((__nothrow__)) {
+	// abort cannot be recursively entered by the same or different processors because all signal handlers return when
+	// the globalAbort flag is true.
+	lock( &kernel_abort_lock );
+
+	// first task to abort ?
+	if ( !kernel_abort_called ) {			// not first task to abort ?
+		kernel_abort_called = true;
+		unlock( &kernel_abort_lock );
+	} 
+	else {
+		unlock( &kernel_abort_lock );
+		
+		sigset_t mask;
+		sigemptyset( &mask );
+		sigaddset( &mask, SIGALRM );			// block SIGALRM signals
+		sigaddset( &mask, SIGUSR1 );			// block SIGUSR1 signals
+		sigsuspend( &mask );				// block the processor to prevent further damage during abort
+		_exit( EXIT_FAILURE );				// if processor unblocks before it is killed, terminate it		
+	}
+
+	return this_thread();
+}
+
+void kernel_abort_msg( void * kernel_data, char * abort_text, int abort_text_size ) {
+	thread_desc * thrd = kernel_data;
+
+	int len = snprintf( abort_text, abort_text_size, "Error occurred while executing task %.256s (%p)", thrd->cor.name, thrd );
+	__lib_debug_write( STDERR_FILENO, abort_text, len );
+
+	if ( thrd != this_coroutine() ) {
+		len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine()->name, this_coroutine() );
+		__lib_debug_write( STDERR_FILENO, abort_text, len );
+	} 
+	else {
+		__lib_debug_write( STDERR_FILENO, ".\n", 2 );
+	}
+}
+
+extern "C" {
+	void __lib_debug_acquire() {
+		lock(&kernel_debug_lock);
+	}
+
+	void __lib_debug_release() {
+		unlock(&kernel_debug_lock);
+	}
 }
 
Index: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision bd4d011a92b605ad83657c777542b73e1fad403f)
+++ src/libcfa/concurrency/thread.c	(revision 9d944b2a97f0468ab2208567dbc494494cf66a93)
@@ -71,5 +71,5 @@
 	this_processor->current_coroutine = thrd_c;
 
-	LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
+	LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
 
 	create_stack(&thrd_c->stack, thrd_c->stack.size);
