Index: kernel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision 48d14222860ca12971697753b0daddbe991a80d4)
+++ kernel/generic/include/proc/thread.h	(revision 7fe9c5b6c103cbe81f8908297a4a3a46ce71ce56)
@@ -42,5 +42,5 @@
 #include <synch/rwlock.h>
 #include <synch/spinlock.h>
-#include <adt/btree.h>
+#include <adt/avl.h>
 #include <mm/slab.h>
 #include <arch/cpu.h>
@@ -91,4 +91,7 @@
 	link_t wq_link;		/**< Wait queue link. */
 	link_t th_link;		/**< Links to threads within containing task. */
+
+	/** Threads linkage to the threads_tree. */
+	avltree_node_t threads_tree_node;
 	
 	/** Lock protecting thread structure.
@@ -205,5 +208,5 @@
 /** Thread list lock.
  *
- * This lock protects all link_t structures chained in threads_head.
+ * This lock protects the threads_tree.
  * Must be acquired before T.lock for each T of type thread_t.
  *
@@ -211,6 +214,6 @@
 SPINLOCK_EXTERN(threads_lock);
 
-/** B+tree containing all threads. */
-extern btree_t threads_btree;
+/** AVL tree containing all threads. */
+extern avltree_t threads_tree;
 
 extern void thread_init(void);
