diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2007-03-26 16:55:17 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2007-03-26 16:55:17 +0000 |
commit | 66258a30a407e7ea4600fc2242438ecbd084d5ea (patch) | |
tree | b5fc767011c814a0fde9811731096f11b9f8c9b9 /firmware/export/thread.h | |
parent | 6c487eb5d115e77ae31b22f24b692bb2df3b90b6 (diff) |
Make scheduler functions thread safe core wise. A big step towards playback running on COP (not yet possible because more protection on file system level is necessary).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12926 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/thread.h')
-rw-r--r-- | firmware/export/thread.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 279ea44835..0e2ba8e885 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h @@ -105,8 +105,11 @@ struct thread_entry { unsigned long statearg; unsigned short stack_size; #ifdef HAVE_PRIORITY_SCHEDULING - unsigned short priority; - unsigned long priority_x; + unsigned char priority; + unsigned char priority_x; +# if NUM_CORES > 1 + unsigned char core; /* To which core threads belongs to. */ +# endif long last_run; #endif struct thread_entry *next, *prev; @@ -116,11 +119,18 @@ struct thread_entry { }; struct core_entry { - struct thread_entry threads[MAXTHREADS]; struct thread_entry *running; struct thread_entry *sleeping; struct thread_entry *waking; struct thread_entry **wakeup_list; +#ifdef HAVE_PRIORITY_SCHEDULING + long highest_priority; +#endif +#if NUM_CORES > 1 + volatile bool lock_issued; + volatile bool kernel_running; +#endif + long last_tick; #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME int switch_to_irq_level; #define STAY_IRQ_LEVEL -1 @@ -171,6 +181,14 @@ struct core_entry { }) #endif +#if NUM_CORES > 1 +inline void lock_cores(void); +inline void unlock_cores(void); +#else +#define lock_cores(...) +#define unlock_cores(...) +#endif + struct thread_entry* create_thread(void (*function)(void), void* stack, int stack_size, const char *name IF_PRIO(, int priority) |