In Phoenix-RTOS kernel each thread is described using thread_t structure. Structure has been presented below.

typedef struct _thread_t {
    struct _thread_t *next;
    struct _thread_t *prev;

    rbnode_t sleeplinkage;
    rbnode_t idlinkage;

    struct _process_t *process;

    volatile enum { READY = 0, SLEEP = 1 } state;

    unsigned int id;
    unsigned int priority;
    struct _thread_t *blocking;

    struct _thread_t **wait;
    volatile time_t wakeup;

    time_t stick;
    time_t utick;

    void *kstack;
    size_t kstacksz;

    spinlock_t execwaitsl;
    struct _thread_t *execwaitq;
    char execfl;
    void *parentkstack;
    struct _thread_t *execparent;

    cpu_context_t *context;
} thread_t;

Fields next and prev are used for scheduler lists. Fields sleeplinkage and idlinkage are used respectively for red-black tree used for representing sleeping threads and for red-black tree representing all threads in the system.