Index: uspace/lib/libc/generic/async.c
===================================================================
--- uspace/lib/libc/generic/async.c	(revision ef8bcc6df47519f80b0b59ebb86b4c416a742a7b)
+++ uspace/lib/libc/generic/async.c	(revision 953769ff5f13f913fbf03e6f1b8aac2f414094f6)
@@ -179,5 +179,4 @@
 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call);
 static void default_interrupt_received(ipc_callid_t callid, ipc_call_t *call);
-static void default_pending(void);
 
 /**
@@ -191,10 +190,4 @@
  */
 static async_client_conn_t interrupt_received = default_interrupt_received;
-
-/**
- * Pointer to a fibril function that will be used to handle pending
- * operations.
- */
-static async_pending_t pending = default_pending;
 
 static hash_table_t conn_hash_table;
@@ -376,40 +369,4 @@
 	
 	fid_t fid = fibril_create(notification_fibril, msg);
-	fibril_add_ready(fid);
-	
-	futex_up(&async_futex);
-	return true;
-}
-
-/** Pending fibril.
- *
- * After each call the pending operations are executed in a separate
- * fibril. The function pending() is c.
- *
- * @param arg Unused.
- *
- * @return Always zero.
- *
- */
-static int pending_fibril(void *arg)
-{
-	pending();
-	
-	return 0;
-}
-
-/** Process pending actions.
- *
- * A new fibril is created which would process the pending operations.
- *
- * @return False if an error occured.
- *         True if the execution was passed to the pending fibril.
- *
- */
-static bool process_pending(void)
-{
-	futex_down(&async_futex);
-	
-	fid_t fid = fibril_create(pending_fibril, NULL);
 	fibril_add_ready(fid);
 	
@@ -514,13 +471,4 @@
 }
 
-/** Default fibril function that gets called to handle pending operations.
- *
- * This function is defined as a weak symbol - to be redefined in user code.
- *
- */
-static void default_pending(void)
-{
-}
-
 /** Wrapper for client connection fibril.
  *
@@ -661,5 +609,5 @@
 	
 out:
-	process_pending();
+	;
 }
 
@@ -1050,14 +998,4 @@
 }
 
-/** Setter for pending function pointer.
- *
- * @param pend Function that will implement a new pending
- *             operations fibril.
- */
-void async_set_pending(async_pending_t pend)
-{
-	pending = pend;
-}
-
 /** Pseudo-synchronous message sending - fast version.
  *
Index: uspace/lib/libc/include/async.h
===================================================================
--- uspace/lib/libc/include/async.h	(revision ef8bcc6df47519f80b0b59ebb86b4c416a742a7b)
+++ uspace/lib/libc/include/async.h	(revision 953769ff5f13f913fbf03e6f1b8aac2f414094f6)
@@ -44,5 +44,4 @@
 typedef ipc_callid_t aid_t;
 typedef void (*async_client_conn_t)(ipc_callid_t callid, ipc_call_t *call);
-typedef void (*async_pending_t)(void);
 
 extern atomic_t async_futex;
@@ -100,5 +99,4 @@
 extern void async_set_client_connection(async_client_conn_t conn);
 extern void async_set_interrupt_received(async_client_conn_t conn);
-extern void async_set_pending(async_pending_t pend);
 
 /* Wrappers for simple communication */
Index: uspace/srv/console/console.c
===================================================================
--- uspace/srv/console/console.c	(revision ef8bcc6df47519f80b0b59ebb86b4c416a742a7b)
+++ uspace/srv/console/console.c	(revision 953769ff5f13f913fbf03e6f1b8aac2f414094f6)
@@ -52,4 +52,6 @@
 #include <event.h>
 #include <devmap.h>
+#include <assert.h>
+#include <fibril_sync.h>
 
 #include "console.h"
@@ -112,12 +114,18 @@
 LIST_INITIALIZE(pending_input);
 
+static FIBRIL_MUTEX_INITIALIZE(input_mutex);
+static FIBRIL_CONDVAR_INITIALIZE(input_cv);
+static input_flag = false;
+
 /** Process pending input requests */
 static void process_pending_input(void)
 {
-	async_serialize_start();
-	
 	link_t *cur;
 	
 loop:
+	fibril_mutex_lock(&input_mutex);
+	while (!input_flag)
+		fibril_condvar_wait(&input_cv, &input_mutex);
+rescan:
 	for (cur = pending_input.next; cur != &pending_input; cur = cur->next) {
 		pending_input_t *pr = list_get_instance(cur, pending_input_t, link);
@@ -133,9 +141,7 @@
 			} else {
 				ipc_answer_4(pr->rid, EOK, ev.type, ev.key, ev.mods, ev.c);
-				
 				list_remove(cur);
 				free(pr);
-				
-				goto loop;
+				goto rescan;
 			}
 		}
@@ -144,14 +150,14 @@
 			(void) ipc_data_read_finalize(pr->callid, pr->data, pr->size);
 			ipc_answer_1(pr->rid, EOK, pr->size);
-			
+
 			free(pr->data);
 			list_remove(cur);
 			free(pr);
-			
-			goto loop;
-		}
-	}
-	
-	async_serialize_end();
+			goto rescan;
+		}
+	}
+	input_flag = false;
+	fibril_mutex_unlock(&input_mutex);
+	goto loop;
 }
 
@@ -454,5 +460,9 @@
 			}
 			
+			fibril_mutex_lock(&input_mutex);
 			keybuffer_push(&active_console->keybuffer, &ev);
+			input_flag = true;
+			fibril_condvar_signal(&input_cv);
+			fibril_mutex_unlock(&input_mutex);
 			break;
 		default:
@@ -515,8 +525,7 @@
 	}
 	
-	async_serialize_start();
-	
 	size_t pos = 0;
 	console_event_t ev;
+	fibril_mutex_lock(&input_mutex);
 	while ((keybuffer_pop(&cons->keybuffer, &ev)) && (pos < size)) {
 		if (ev.type == KEY_PRESS) {
@@ -533,8 +542,8 @@
 		pending_input_t *pr = (pending_input_t *) malloc(sizeof(pending_input_t));
 		if (!pr) {
+			fibril_mutex_unlock(&input_mutex);
 			ipc_answer_0(callid, ENOMEM);
 			ipc_answer_0(rid, ENOMEM);
 			free(buf);
-			async_serialize_end();
 			return;
 		}
@@ -548,13 +557,12 @@
 		list_append(&pr->link, &pending_input);
 	}
-	
-	async_serialize_end();
+	fibril_mutex_unlock(&input_mutex);
 }
 
 static void cons_get_event(console_t *cons, ipc_callid_t rid, ipc_call_t *request)
 {
-	async_serialize_start();
-	
 	console_event_t ev;
+
+	fibril_mutex_lock(&input_mutex);
 	if (keybuffer_pop(&cons->keybuffer, &ev)) {
 		ipc_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);
@@ -562,6 +570,6 @@
 		pending_input_t *pr = (pending_input_t *) malloc(sizeof(pending_input_t));
 		if (!pr) {
+			fibril_mutex_unlock(&input_mutex);
 			ipc_answer_0(rid, ENOMEM);
-			async_serialize_end();
 			return;
 		}
@@ -573,6 +581,5 @@
 		list_append(&pr->link, &pending_input);
 	}
-	
-	async_serialize_end();
+	fibril_mutex_unlock(&input_mutex);
 }
 
@@ -716,11 +723,8 @@
 static bool console_init(void)
 {
-	async_serialize_start();
-	
 	/* Connect to keyboard driver */
 	kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
 	if (kbd_phone < 0) {
 		printf(NAME ": Failed to connect to keyboard service\n");
-		async_serialize_end();
 		return false;
 	}
@@ -729,10 +733,16 @@
 	if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) {
 		printf(NAME ": Failed to create callback from keyboard service\n");
-		async_serialize_end();
 		return false;
 	}
 	
-	async_set_pending(process_pending_input);
 	async_new_connection(phonehash, 0, NULL, keyboard_events);
+
+	fid_t fid = fibril_create(process_pending_input, NULL);
+	if (!fid) {
+		printf(NAME ": Failed to create fibril for handling pending "
+		    "input\n");
+		return -1;
+	}
+	fibril_add_ready(fid);
 	
 	/* Connect to framebuffer driver */
@@ -740,5 +750,4 @@
 	if (fb_info.phone < 0) {
 		printf(NAME ": Failed to connect to video service\n");
-		async_serialize_end();
 		return -1;
 	}
@@ -748,5 +757,4 @@
 	if (rc < 0) {
 		printf(NAME ": Unable to register driver (%d)\n", rc);
-		async_serialize_end();
 		return false;
 	}
@@ -784,5 +792,4 @@
 			    fb_info.cols, fb_info.rows) == NULL) {
 				printf(NAME ": Unable to allocate screen buffer %u\n", i);
-				async_serialize_end();
 				return false;
 			}
@@ -798,5 +805,4 @@
 				devmap_hangup_phone(DEVMAP_DRIVER);
 				printf(NAME ": Unable to register device %s\n", vc);
-				async_serialize_end();
 				return false;
 			}
@@ -808,4 +814,5 @@
 	
 	/* Initialize the screen */
+	async_serialize_start();
 	gcons_redraw_console();
 	set_rgb_color(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
@@ -813,4 +820,5 @@
 	curs_goto(0, 0);
 	curs_visibility(active_console->scr.is_cursor_visible);
+	async_serialize_end();
 	
 	/* Receive kernel notifications */
@@ -820,5 +828,4 @@
 	async_set_interrupt_received(interrupt_received);
 	
-	async_serialize_end();
 	return true;
 }
