rbtree implemented in thread.c

dfdfdf