00001 00038 #ifndef MAINLOOP_H_INCLUDED 00039 #define MAINLOOP_H_INCLUDED 00040 00041 #include <slist.h> 00042 #include <sleep.h> 00043 #include <workqueue.h> 00044 00045 #ifdef CONFIG_SOFTIRQ 00046 #include <softirq.h> 00047 #endif 00048 00063 __noreturn static inline void mainloop_run(struct workqueue *queue) 00064 { 00065 while (1) { 00066 struct workqueue_task *task; 00067 00068 #ifdef CONFIG_SOFTIRQ 00069 assert(softirq_is_enabled()); 00070 #endif 00071 00072 cpu_irq_disable(); 00073 #ifdef CONFIG_SOFTIRQ 00074 softirq_poll(); 00075 #endif 00076 task = workqueue_pop_task(queue); 00077 if (task) { 00078 cpu_irq_enable(); 00079 workqueue_run_task(task); 00080 } else { 00081 cpu_enter_sleep(); 00082 } 00083 } 00084 } 00085 00087 00088 #endif /* MAINLOOP_H_INCLUDED */
1.6.3