Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 268209e..a00f131 100644 static int kinetic_callback(struct timeout *tmo) } queue_post(&button_queue, BUTTON_TOUCHSCREEN, 0); + thread_run_next(THREAD_ID_MAIN); /* stop if the velocity hit or crossed zero */ if (!data->velocity) { diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 87c2d2d..537a826 100644 struct thread_entry creation or thread_set_priority) */ unsigned char priority; /* Scheduled priority (higher of base or all threads blocked by this one) */ + unsigned char saved_priority; /* temoprarily saved base priority for + boosting a thread for a short time */ #endif uint16_t id; /* Current slot id */ unsigned short stack_size; /* Size of stack in bytes */ diff --git a/firmware/thread.c b/firmware/thread.c index 655af1a..e520beb 100644 void switch_thread(void) } } + if (thread->saved_priority != 0) + { + thread_set_priority(thread->id, thread->saved_priority); + thread->saved_priority = 0; + } + /* And finally give control to the next thread. */ load_context(&thread->context); int thread_set_priority(unsigned int thread_id, int priority) { int old_priority = thread->priority; - old_base_priority = thread->base_priority; + old_base_priority = thread->base_priority & 0xf; thread->base_priority = priority; prio_move_entry(&thread->pdist, old_base_priority, priority); int thread_get_priority(unsigned int thread_id) return base_priority; } + +void thread_run_next(unsigned int thread_id) +{ + struct thread_entry *thread = thread_id_entry(thread_id); + int old_prio = thread_get_priority(thread->id); + if (old_prio != -1 && thread->saved_priority == 0) + { + thread_set_priority(thread->id, PRIORITY_REALTIME_1); + thread->saved_priority = old_prio; + } +} + #endif /* HAVE_PRIORITY_SCHEDULING */ #ifdef HAVE_IO_PRIORITY |