1. Class Cyg_Thread
    1. Class Cyg_HardwareThread
      1. // Static class to provide common func. Class Cyg_Scheduler
        1. Class_Scheduler_Implementation
          1. Class Scheduler_Base
          2. Class Cyg_Scheduler_SchedLock
          3. // Current running thread static Cyg_Thread * volatile current_thread[CYGNUM_KERNEL_CPU_MAX];
        2. static void unlock_inner(...);
        3. static void lock();
        4. static void unlock();
        5. static void reschedule();
        6. static unlock_reschedule();
        7. static unlock_simple();
        8. static void start();
        9. static void start_cpu();
        10. static Cyg_Scheduler scheduler;
      2. CYG_ADDRESS stack_base;
      3. cyg_uint32 stack_size;
      4. CYG_ADDRESS stack_ptr;
      5. cyg_thread_entry *entry_point;
      6. CYG_ADDRWORD entry_data;
      7. HAL_SaveRegisters *saved_context;
        1. //eg: hal/gx/ck/arch/v3_0/include/hal_arch.h typedef struct { ... ) HAL_SaveRegisters;
      8. static void thread_entry( Cyg_Thread *thread);
      9. void attach_stack( CYG_ADDRESS stack, cyg_uint32 stack_size);
      10. CYG_ADDRESS detach_stack();
    2. Class Cyg_SchedThread
      1. Class Cyg_SchedThread_Implementation
        1. void register_thread(Cyg_Thread *thread);
      2. Cyg_ThreadQueue *queue;
        1. class Cyg_ThreadQueue
          1. Class Cyg_ThreadQueue_Implementation
    3. Cyg_Thread(... );
      1. Cyg_Thread::Cyg_Thread( CYG_ADDRWORD sched_info, cyg_thread_entry *entry, CYG_ADDRWORD entry_data, char *name_arg, CYG_ADDRESS stack_base, cyg_ucount32 stack_size, int static_stack ): Cyg_HardwareThread(entry, entry_data, stack_size, stack_base), Cyg_SchedThread(this, sched_info), timer(this) { ... }
        1. add_to_list();
        2. Cyg_Scheduler.register_thread(this);
        3. init_context(this);
    4. static Cyg_Thread *thread_list;
    5. Cyg_Thread *list_next;
    6. void add_to_list( void);
    7. void remove_from_list( void);
    8. static Cyg_Thread *get_list_head();
    9. Cyg_Thread *get_list_next();
  2. mlqueue/bitmap/lottery
    1. Cyg_Scheduler_Implementation
    2. Cyg_SchedThread_Implementation
    3. Cyg_ThreadQueue_Implementation
  3. Timer Interrupt principle
    1. Cyg_RealTimeClock Cyg_RealTimeClock::rtc CYG_INIT_PRIORITY(CLOCK);
      1. Class Cyg_Clock
        1. Class Cyg_counter
          1. Cyg_Alarm_List alarm_list;
          2. Cyg_Counter::tick(count);
          3. {for(alarm_list) alarm->alarm();}
      2. Cyg_Interrupt interrupt;
        1. static cyg_uint32 isr(cyg_vector vector, CYG_ADDRWORD data);
          1. Almost do nothing, except call dsr
        2. static void dsr(cyg_vector vector, cyg_ucount32 count, CYG_ADDRWORD data);
          1. {rtc->tick(count);}
    2. Class Cyg_Thread : public Cyg_HardwareThread, public Cyg_SchedThread
      1. Cyg_ThreadTimer timer;
        1. Class Cyg_Alarm
        2. static void alarm( Cyg_Alarm *alarm, CYG_ADDRWORD data);
          1. {Cyg_Scheduler::unlock;}
          2. {Cyg_Scheduler::unlock_inner();}
          3. {CygInterrupt::call_pending_DSRs();}
          4. {HAL_THREAD_SWITCH_CONTEXT;}
  4. externC void cyg_thread_create(...);