previous | start | next

Some uthread data structures

These are mostly defined in file uthread.h.

  1. The uthread_t type (aka a thread control block)

    typedef struct uthread {
        list_link_t         ut_link;        /* link on waitqueue / scheduler */
    
        uthread_ctx_t       ut_ctx;         /* context */
        char               *ut_stack;       /* user stack */
    
        uthread_id_t        ut_id;          /* thread's id */
        uthread_state_t     ut_state;       /* thread state */
        int                 ut_prio;        /* thread's priority */
        int                 ut_errno;       /* thread's errno */
        int                 ut_has_exited;  /* thread exited? */
        int                 ut_exit;        /* thread's exit value */
    
        int                 ut_detached;    /* thread is detached? */
        struct uthread      *ut_waiter;     /* thread waiting to join with me */
    } uthread_t;
    
           
    
    • list_link_t is just 2 pointers: prev and next. Used to insert the uthread_t on scheduling lists, wait lists.


previous | start | next