summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-04-03 22:02:09 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-04-03 22:02:09 +0000
commit376d8d577fe94a8dc8742deff5a7524aa1595e1c (patch)
tree4d76e5232d8b513a40f11588d0f6899d47336b49 /firmware/thread.c
parentba7501513a87433043a217a813c9147d004314a5 (diff)
downloadrockbox-376d8d577fe94a8dc8742deff5a7524aa1595e1c.tar.gz
rockbox-376d8d577fe94a8dc8742deff5a7524aa1595e1c.zip
Add IO priority handling. Currently all IO has equal priority, except the dircache scanning thread which is lower. This fixes the slow boot problem for me, with the added benefit that actual audio playback also starts faster.
Lots of the changes are due to changing storage_(read|write)sectors() from macros to wrapper functions. This means that they have to be called with IF_MD2(drive,) again. Flyspray: FS#11167 Author: Frank Gevaerts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25459 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index 38933f623e..81ef42a6b0 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -2413,6 +2413,11 @@ unsigned int create_thread(void (*function)(void),
2413 prio_add_entry(&thread->pdist, priority); 2413 prio_add_entry(&thread->pdist, priority);
2414#endif 2414#endif
2415 2415
2416#ifdef HAVE_IO_PRIORITY
2417 /* Default to high (foreground) priority */
2418 thread->io_priority = IO_PRIORITY_IMMEDIATE;
2419#endif
2420
2416#if NUM_CORES > 1 2421#if NUM_CORES > 1
2417 thread->core = core; 2422 thread->core = core;
2418 2423
@@ -2918,6 +2923,20 @@ int thread_get_priority(unsigned int thread_id)
2918} 2923}
2919#endif /* HAVE_PRIORITY_SCHEDULING */ 2924#endif /* HAVE_PRIORITY_SCHEDULING */
2920 2925
2926#ifdef HAVE_IO_PRIORITY
2927int thread_get_io_priority(unsigned int thread_id)
2928{
2929 struct thread_entry *thread = thread_id_entry(thread_id);
2930 return thread->io_priority;
2931}
2932
2933void thread_set_io_priority(unsigned int thread_id,int io_priority)
2934{
2935 struct thread_entry *thread = thread_id_entry(thread_id);
2936 thread->io_priority = io_priority;
2937}
2938#endif
2939
2921/*--------------------------------------------------------------------------- 2940/*---------------------------------------------------------------------------
2922 * Starts a frozen thread - similar semantics to wakeup_thread except that 2941 * Starts a frozen thread - similar semantics to wakeup_thread except that
2923 * the thread is on no scheduler or wakeup queue at all. It exists simply by 2942 * the thread is on no scheduler or wakeup queue at all. It exists simply by